简体   繁体   English

laravel 8 安装错误 - npm 运行开发抛出错误

[英]laravel 8 instalation error - npm run dev throws error

I am trying to install a fresh laravel 8 project.我正在尝试安装一个新的 laravel 8 项目。 After downloading frontend scaffolding when I try to run npm run dev it gives me an error.下载前端脚手架后,当我尝试运行npm run dev时出现错误。 This problem also happens during installing jetstream in this npm run dev .在此npm run dev中安装 jetstream 期间也会发生此问题。 I am giving error below.我在下面给出错误。

unkno@DESKTOP-NAP4DRR MINGW64 /c/laravel projects/example
$ npm run dev

> @ dev C:\laravel projects\example
> npm run development


> @ development C:\laravel projects\example
> mix

[webpack-cli] Running multiple commands at the same time is not possible
[webpack-cli] Found commands: 'bundle', 'projects\example\node_modules\laravel-mix\setup\webpack.config.js'
[webpack-cli] Run 'webpack --help' to see available commands and options
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `mix`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\unkno\AppData\Roaming\npm-cache\_logs\2021-01-09T03_39_54_620Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\unkno\AppData\Roaming\npm-cache\_logs\2021-01-09T03_39_54_704Z-debug.log


I experienced the same problem a few weeks ago.几周前我遇到了同样的问题。 What I figured out was that on windows that instead of running the command npm install && npm run dev it needed to be npm install and npm run-dev . What I figured out was that on windows that instead of running the command npm install && npm run dev it needed to be npm install and npm run-dev .

Also make sure you have the latest node and npm versions install.还要确保您安装了最新的节点和 npm 版本。 Perform a npm audit fix as well to fix any vulnerabilities.执行 npm 审计修复以及修复任何漏洞。

I can see you are a Windows developer, and that you have spaces in the name of your project folder.我可以看到您是 Windows 开发人员,并且您的项目文件夹名称中有空格。 Windows, spaces and nodejs don't like to behave very nicely together. Windows,空格和 nodejs 不喜欢表现得很好。

Try removing the spaces from name of your project path and see if this addresses the issue for you.尝试从项目路径的名称中删除空格,看看这是否为您解决了问题。

Update : As per a similar question, Laravel, error when running npm run dev on fresh new installation , this solved the users issue.更新:根据类似的问题, Laravel,在全新安装上运行 npm 运行开发时出错,这解决了用户问题。

Try doing a full reset:尝试进行完全重置:

rm -rf node_modules

rm package-lock.json yarn.lock

npm cache clear --force

npm install

It works for me, on Laravel 9它对我有用,在 Laravel 9

Thanks to Sir Jeffrey Way感谢Jeffrey Way爵士

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM