NPM模块安装错误“代码ELIFECYCLE”“ errno 4058”

错误:

每次我尝试使用npm安装某些模块时,都会在控制台中获得以下输出日志:

1:C:\Windows\system32>npm install -g serialport
2:"CALL "C:\Users\<user>\Documents\nodejs\\node.exe" 
3:"C:\Users\<user>\Documents\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g" is not recognized as an
4:internal or external command,5:programa o archivo por lotes ejecutable.
6:npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible --
7:are you offline?
8:npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during
9:revalidation.
10:
11:> @serialport/bindings@8.0.6 install
12:C:\Users\<user>\AppData\Roaming\npm\node_modules\serialport\node_modules\@serialport\bindings
13:> prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
14:
15:npm ERR! code ELIFECYCLE
16:npm ERR! syscall spawn C:\Windows\system32\cmd.exe;C:\Python34;
17:npm ERR! file C:\Windows\system32\cmd.exe;C:\Python34;
18:npm ERR! path C:\Windows\system32\cmd.exe;C:\Python34;
19:npm ERR! errno -4058
20:npm ERR! @serialport/bindings@8.0.6 install: `prebuild-install --tag-prefix @serialport/bindings@ || 
21:node-gyp rebuild`
22:npm ERR! spawn C:\Windows\system32\cmd.exe;C:\Python34; ENOENT
23:npm ERR!
24:npm ERR! Failed at the @serialport/bindings@8.0.6 install script.
25:npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
26:
27:npm ERR! A complete log of this run can be found in:
28:npm ERR!     C:\Users\<user>\AppData\Roaming\npm-cache\_logs\2020-01-25T14_44_28_892Z-debug.log 

(请注意,此输出中的行枚举是手工制作的,与实际的输出行不符。这只是为了更好地指出问题)

头灯:

  • npm ERR!代码ELIFECYCLE
  • npm ERR! errno -4058
  • npm ERR! @ serialport / bindings @ 8.0.6安装脚本失败。

当我尝试运行命令npm install -g <module>或什至只是npm install <module>来执行本地操作时,会弹出此错误。


2 4 行之间可以看到的输出日志是我每次尝试运行npm时都会得到的 命令,无论是否为“ npm install”或任何其他命令。

示例:

C:\Windows\system32>npm -v
"CALL "C:\Users\<user>\Documents\nodejs\\node.exe" "C:\Users\<user>\Documents\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g" npm' is not recognized as an internal or external command,operable program,or batch file.
6.13.6

在此示例和上一个示例中,您可以看到:即使我收到此错误消息,该命令也会在出现此错误后执行。


其他信息

flyercatch 回答:NPM模块安装错误“代码ELIFECYCLE”“ errno 4058”

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2713062.html

大家都在问