運行vue項目報如下錯誤:
npm ERR! code ELIFECYCLE npm ERR! errno 126 npm ERR! todos@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js` npm ERR! Exit status 126 npm ERR! npm ERR! Failed at the todos@1.0.0 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! /Users/lijie/.npm/_logs/2020-05-10T13_50_02_149Z-debug.log
原因:可能是由於node_modules模塊中缺失或者某些東西沖突引起的,我們可以使用如下的方法解決這個問題:
在項目下依次輸入以下命令:先移除原項目的node_modules模塊和package-lock.json,再強制清除緩存,然后重新安裝,
rm -rf node_modules rm package-lock.json npm cache clear --force npm install
最后運行項目,完美解決。