NPM在Laravel 9中运行DEV

发布于 2025-02-12 01:37:54 字数 308 浏览 2 评论 0原文

在此处输入图像描述当我在Laravel创建一个新项目时,我有问题构建验证...这是我的cmd命令:

laravel new laravel2030
cd laravel2030
composer require laravel/ui 
php artisan ui bootstrap --auth
npm install 
npm run dev 

enter image description hereI have a problem when I create a new project in laravel and I want to build authintication ...this is my cmd command :

laravel new laravel2030
cd laravel2030
composer require laravel/ui 
php artisan ui bootstrap --auth
npm install 
npm run dev 

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

兮颜 2025-02-19 01:37:54

在Laravel 9更新中,我们使用Vite而不是混合
然后,您需要下面的运行命令,而不是npm运行dev才能构建app.js,app.css:

运行vite命令以构建资产文件

npm run build

在以下内容中查看有关此信息的更多信息: https://techvblogs.com/blog/blog/blog/how-to-to-install- Bootstrap-5-in-laravel-9-with-with-vite

in laravel 9 update we use Vite instead of mix
then you need run command below instead npm run dev to build app.js, app.css:

Running Vite Command to build Asset File

npm run build

see more about this in:https://techvblogs.com/blog/how-to-install-bootstrap-5-in-laravel-9-with-vite

黯淡〆 2025-02-19 01:37:54

现在,Laravel开始实现Vite而不是Mixin

,因此您需要还原回混合,我不建议您

通过插入Laravel Mix

npm i laravel-mix

package.json中的脚本部分。

"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},

,然后更新 与vite兼容,我认为这是时间问题,直到Laravel UI软件包进行更新以默认实现此目标
您可以从步骤5开始(如果您已经有了一个项目)开始此教程,或者从第一步开始创建新项目,并查看如何修复此

https://techvblogs.com/blog/how-to-to-now-to-now-to-install-bootstall-bootstall-bootstall-bootstall-5-in-laravel-9 -with-vite

您只需要在4个文件中进行编辑即可解决此问题

now laravel started to implement Vite instead of mixin

so you need to revert back to mix which I don't recommend

by intsalling laravel mix

npm i laravel-mix

then update the scripts section in package.json to be like this

"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},

OR second option update your laravel ui view files to be compatible with vite which I think is a matter of time till laravel ui package make an update to implement this by default
You can follow this tutorial starting from step 5(if you already have a project) or follow from first step to create new project and see how you can fix this

https://techvblogs.com/blog/how-to-install-bootstrap-5-in-laravel-9-with-vite

you'll just need to edit in 4 files I think to fix this

俯瞰星空 2025-02-19 01:37:54

在package.json文件中进行问题

认为您必须

    "scripts": {
    "dev": "vite",
    "build": "mix build"
    }

    "scripts": {
    "dev": "mix",
    "build": "mix build"
    }

I think the problem in package.json file

You have to change "dev": "vite" in package.json

    "scripts": {
    "dev": "vite",
    "build": "mix build"
    }

to be "dev":"mix" like this

    "scripts": {
    "dev": "mix",
    "build": "mix build"
    }

and run npm run dev again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文