laravel npm运行生产成功编译,但是npm ERR!代码ELIFECYCLE

时间:2020-03-13 09:28:55

标签: node.js laravel npm webpack

npm run dev

成功。

npm run prod 

失败:

错误!代码ELIFECYCLE

npm run prod之后的

npm日志消息:

DONE  Compiled successfully in 91052ms                                                                                                                                                     8:46:32 AM

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ production 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!     /root/.npm/_logs/2020-03-13T08_46_33_901Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ prod: `npm run production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ prod 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!     /root/.npm/_logs/2020-03-13T08_46_33_920Z-debug.log


To maintain team`s package version consistency,package version is fixed in package-lock.json.

出什么问题了?

1 个答案:

答案 0 :(得分:1)

您可以尝试清除npm缓存并删除node_module文件夹。

删除npm缓存

$ npm cache clean --force

通过

删除node_modules
$ rm -rf node_modules package-lock.json

或手动将其删除。

然后运行

$ npm install