【发布时间】:2021-12-01 23:38:51
【问题描述】:
尝试执行 npm 安装时,我在 Git Bash 中不断收到此错误:
64 verbose stack Error: command failed
64 verbose stack at ChildProcess.<anonymous> (C:\Users\baseuser\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
64 verbose stack at ChildProcess.emit (events.js:400:28)
64 verbose stack at maybeClose (internal/child_process.js:1058:16)
64 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
65 verbose pkgid app-backend@1.0.1-dev.0
66 verbose cwd C:\work\gitrepo\app-backend
67 verbose Windows_NT 10.0.18363
68 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\baseuser\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
69 verbose node v14.18.0
70 verbose npm v8.0.0
71 error code 1
72 error path C:\work\gitrepo\app-backend
73 error command failed
74 error command C:\windows\system32\cmd.exe /d /s /c npm run build
75 verbose exit 1
我已经全局安装了 node 和 npm,并且 npm install 可以在 Powershell 或 Windows 命令行中运行,但由于某种原因不能在 Git Bash 中运行。我已将它们添加到 PATH 变量中。我完成了npm clear cache -force,但没有任何改变。
使用 git bash 删除节点、npm、git 并重新安装它们,但错误仍然存在。
【问题讨论】:
标签: node.js npm npm-install git-bash