当我尝试安装 npm 时出现以下错误。
npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "server" npm ERR! node v7.5.0 npm ERR! npm v4.3.0 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! voting_app@1.1.0 server: `live-server --public -- host=localhost --port=3000 --middleware=./disable-browser-cache.js` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the voting_app@1.1.0 server script 'live-server -- public --host=localhost --port=3000 --middleware=./disable-browser- cache.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the voting_app package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! live-server --public --host=localhost --port=3000 -- middleware=./disable-browser-cache.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs voting_app npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls voting_app npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /Users/ItsMeMrLi/.npm/_logs/2017-02-17T22_48_03_581Z- debug.log npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v7.5.0 npm ERR! npm v4.3.0 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! voting_app@1.1.0 start: `npm run server` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the voting_app@1.1.0 start script 'npm run server'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the voting_app package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run server npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs voting_app npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls voting_app npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /Users/ItsMeMrLi/.npm/_logs/2017-02-17T22_48_03_655Z- debug.log
解决方案
请按照以下步骤解决该错误:
清理缓存和 Node_module
另外,清除 npm 缓存 clean --force
然后删除node_modules文件夹
另外,删除 package-lock.json 文件
然后重新安装npm文章来源:https://www.toymoban.com/article/451.html
文章来源地址https://www.toymoban.com/article/451.html
到此这篇关于如何解决 Node JS 中的 npm 错误“npm ERR!code ELIFECYCLE”的文章就介绍到这了,更多相关内容可以在右上角搜索或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!