npm run build报错(npm ERR! code ELIFECYCLE)的解决办法
今天突然遇到这个问题:
Description:
ze Chunks Chunk Names
mix.js 8.27 kB 0 [emitted] mix
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js –progress –hide-modules –config=node_modules/laravel-mix/setup/webpack.config.js
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! /Users/sunny/.npm/_logs/2017-12-21T17_00_33_319Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: npm run development
npm ERR! Exit status 2
npm ERR!
解决方案:
原因是:node_modules安装问题
rm -rf node_modules rm package-lock.json npm cache clear --force npm install
最后再npm run build
如果还不行:
Step1:npm cache clean --force
Step2:rm -rf node_modules
Step3:rm -rf package-lock.json
Step4:npm install
npm install
成功之后再次启动npm start