laravel 8 安装错误 - npm run dev 抛出错误

时间:2021-01-09 03:42:00

标签: node.js laravel npm webpack laravel-8

我正在尝试安装一个新的 Laravel 8 项目。下载前端脚手架后,当我尝试运行 npm run dev 时,它给了我一个错误。此问题在此 npm run dev 中安装 jetstream 时也会发生。我在下面给出错误。

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


2 个答案:

答案 0 :(得分:1)

几周前我遇到了同样的问题。我发现在 Windows 上,不是运行命令 npm install && npm run dev,而是需要 npm install 和 npm run-dev

还要确保您安装了最新的 node 和 npm 版本。执行 npm 审核修复以修复任何漏洞。

答案 1 :(得分:0)

我可以看出您是 Windows 开发人员,并且您的项目文件夹名称中有空格。 Windows、spaces 和 nodejs 不喜欢一起表现得很好。

尝试从您的项目路径名称中删除空格,看看这是否能解决您的问题。

更新:根据类似问题Laravel, error when running npm run dev on fresh new installation,这解决了用户问题。