首页 > 技术文章 > vue的错误的ERR!代码ELIFECYCLE

chaojibaidu 2020-08-06 17:02 原文

错误的ERR!代码ELIFECYCLE

宝慕林4294392 2019-08-31 14:40:35

我正在尝试学习反应,所以我有这个示例代码为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环境。快乐编码!!

 

 反对2019-08-31
 
?
慕田峪7331174

清洁CacheNode_module不够。请遵循以下步骤:

  • npm cache clean --force

  • 删除node_modules文件夹

  • 删除package-lock.json文件

  • npm install

它对我有用。

 

 反对2019-08-31
 
?
慕桂英3389331

我先跑了:

 

npm run clean

(即使它有错误)

 

然后我删除了node_modules文件夹并运行

 

npm install

这似乎解决了这个问题。

 

推荐阅读