当前位置: 首页 > 知识库问答 >
问题:

如何解决npm错误"npm ERR!代码ELIFECYCLE”

戚令秋
2023-03-14

我试图学习反应,所以我有这个示例代码的全堆栈反应投票应用程序,我试图让它工作,但运行npm安装后,接着npm启动我收到以下错误,当我运行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

这是我的package.json:

{
  "name": "voting_app",
  "version": "1.1.0",
  "author": "Fullstack.io",
  "scripts": {
    "go": "open http://localhost:3000; npm run server",
    "e2e": "nightwatch",
    "test": "./node_modules/.bin/concurrently -k 'npm run server' 'npm  
run e2e'",
    "start": "npm run server",
    "server": "live-server public --host=localhost --port=3000 --  
middleware=./disable-browser-cache.js"
  },
  "private": true,
  "devDependencies": {
  "concurrently": "2.2.0",
  "live-server": "git://github.com/acco/live-server.git"
},
  "dependencies": {
  "semantic-ui": "git://github.com/Semantic-Org/Semantic-
  UI.git#27d58a01793b66318478fbc5b6676804d22d065d"
  }
}

最后是我的日志文件:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@4.3.0
3 info using node@v7.5.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle voting_app@1.1.0~prestart: voting_app@1.1.0
6 silly lifecycle voting_app@1.1.0~prestart: no script for prestart, continuing
7 info lifecycle voting_app@1.1.0~start: voting_app@1.1.0
8 verbose lifecycle voting_app@1.1.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle voting_app@1.1.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/ItsMeMrLi/Downloads/fullstack-react-code/voting_app/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/ItsMeMrLi/.rvm/gems/ruby-2.3.1/bin:/Users/ItsMeMrLi/.rvm/gems/ruby-2.3.1@global/bin:/Users/ItsMeMrLi/.rvm/rubies/ruby-2.3.1/bin:/Users/ItsMeMrLi/.cargo/bin:/usr/local/Cellar/smlnj/110.74/libexec/bin:/usr/local/bin:/Users/ItsMeMrLi/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Downloads/geckodriver:/usr/local/bin:/Users/ItsMeMrLi/.rvm/bin
10 verbose lifecycle voting_app@1.1.0~start: CWD: /Users/ItsMeMrLi/Downloads/fullstack-react-code/voting_app
11 silly lifecycle voting_app@1.1.0~start: Args: [ '-c', 'npm run server' ]
12 silly lifecycle voting_app@1.1.0~start: Returned: code: 1  signal: null
13 info lifecycle voting_app@1.1.0~start: Failed to exec start script
14 verbose stack Error: voting_app@1.1.0 start: `npm run server`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:192:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:192:7)
14 verbose stack     at maybeClose (internal/child_process.js:890:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid voting_app@1.1.0
16 verbose cwd /Users/ItsMeMrLi/Downloads/fullstack-react-code/voting_app
17 error Darwin 16.4.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v7.5.0
20 error npm  v4.3.0
21 error code ELIFECYCLE
22 error errno 1
23 error voting_app@1.1.0 start: `npm run server`
23 error Exit status 1
24 error Failed at the voting_app@1.1.0 start script 'npm run server'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the voting_app package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error     npm run server
24 error You can get information on how to open an issue for this project with:
24 error     npm bugs voting_app
24 error Or if that isn't available, you can get their info via:
24 error     npm owner ls voting_app
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]

共有3个答案

潘青青
2023-03-14

首先我跑了:

npm run clean

(即使它伴随着错误)

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

npm install

这似乎解决了问题。

屈翰飞
2023-03-14

清除CacheNode_module是不够的。遵循以下步骤:

  • npm缓存清理--强制执行
  • 删除节点\u模块文件夹
  • 删除包锁.json文件
  • npm安装

它对我来说是这样的。

杜凯
2023-03-14

步骤1:$npm缓存清理--强制执行

步骤2:通过$rm-rf node_modules(windows中的rmdir/S/Q node_modules)文件夹删除节点_模块,或通过进入目录并右键单击手动删除它

步骤3:npm安装

要重新启动,$npm start

这对我有用。希望它对你也有用。

PS:如果它仍然存在,请检查它以红色显示的错误,并采取相应的行动。此错误特定于node.js环境。

 类似资料:
  • 我不熟悉node。js。这是我的包裹。json文件 在heroku服务器上,我得到了这些错误日志 我在npm git上收到这些错误。谁能解决这个问题。 0信息如果以“确定”结尾,则有效 1 verbose cli[“C:\Program Files\nodejs\\node.exe”, 1详细的cli'C:\Program Files\nodejs\node_modules\npm\bin\npm

  • 我对vue.js非常陌生,现在我正在尝试使用https://ly525.github.io/material-vue-daterange-picker/guide.html#Introduction中的vue.js datepicker 但是当我导入要使用的脚本时,我会得到这样的消息 “VMDDateRangePicker”已声明,但其值从未读取。TS(6133)找不到模块“v-md-date-r

  • 我写电子邮件类: 但我只得到了这个错误,我不理解这个错误。这意味着什么以及如何解决 错误:错误:在TCPConnectW连接ECONNREFUSED3.209.246.195:2525rap.after连接[作为完成](net.js:1146: 16){errno:-4078,代码:“ESOCKET”,系统调用:“连接”,地址:“3.209.246.195”,端口:2525,命令:“CONN”}

  • 我试图更新一个列,但在更新过程中总是有相同的错误,如果我不想禁用“安全更新模式”,我该如何解决这个问题?这是我的查询 错误代码:1175。您使用的是安全更新模式,并且您试图更新一个没有使用键列禁用安全模式的表,请在“首选项”中切换该选项-

  • 我有这个问题,当我想要引导角项目 尝试安装插件 您必须在angular-cli项目中才能使用serve命令。 npm错误!代码ELIFECYCLE npm错误!错误1 npm错误!portal-app@0.0.0start:ng serve-proxy-config proxy.config.json npm err!退出状态%1 npm错误!npm错误!portal-app@0.0.0启动脚本失

  • 问题内容: 重新安装Node和Git后尝试运行时收到以下错误 任何人都不知道是什么原因导致的,以及如何解决它? (已删除公司详细信息) 问题答案: 建议的第一步是使用最新的npm: (您可能需要)。您正在使用npm 2.x,最新的是3.5.x。