Laravel Mix npm在服务器上运行开发错误ELIFECYCLE

时间:2018-09-22 12:56:57

标签: laravel npm webpack laravel-mix

我们有一个Laravel应用程序,并且正在使用Laravel Mix作为我们的构建系统。在运行npm run dev时,即使同一台计算机在本地笔记本电脑上运行得很好,我们也会在服务器上出现错误。这是怎么回事?

这是我们在控制台上看到的:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --verbose --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
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!     /home/ubuntu/.npm/_logs/2018-09-22T12_33_57_408Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
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!     /home/ubuntu/.npm/_logs/2018-09-22T12_33_57_425Z-debug.log

这是npm日志:

12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `npm run development`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:961:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
...
20 error code ELIFECYCLE
21 error errno 1
22 error @ dev: `npm run development`
22 error Exit status 1

2 个答案:

答案 0 :(得分:1)

您是否尝试过删除项目中的node_modules /文件夹?

rm -rf node_modules

然后运行...

npm install

答案 1 :(得分:0)

问题是服务器上的RAM“用完了”。该错误很难调试,没有正确的错误消息。