錯誤的ERR!代碼ELIFECYCLE
我正在嘗試學習反應,所以我有這個示例代碼為fullstack反應投票應用程序,我試圖讓它工作,但在運行npm install后跟npm start我收到以下錯誤:
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
3 回答

步驟1: $ npm cache clean --force
步驟2:按文件夾刪除node_modules$ rm -rf node_modules
或通過進入目錄手動刪除它,然后右鍵單擊>刪除。也刪除package-lock.json文件。
第3步: npm install
重新開始 $ npm start
這對我有用。希望它也適合你。
PS:如果它在那里,請檢查它以紅色顯示的錯誤並采取相應措施。此錯誤特定於node.js環境。快樂編碼!!

清潔Cache
並Node_module
不夠。請遵循以下步驟:
-
npm cache clean --force
-
刪除
node_modules
文件夾 -
刪除
package-lock.json
文件 -
npm install
它對我有用。

我先跑了:
npm run clean
(即使它有錯誤)
然后我刪除了node_modules文件夾並運行
npm install
這似乎解決了這個問題。