简体   繁体   English

Git bash 不执行 npm install

[英]Git bash doesn't execute npm install

I keep getting this error in Git Bash when trying to do an npm install:尝试执行 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

I have node and npm installed globally and npm install works in Powershell or Windows Command line, but not in Git Bash for some reason.我在全局安装了 node 和 npm,并且 npm install 可以在 Powershell 或 Windows 命令行中运行,但由于某种原因不能在 Git Bash 中运行。 I have them added to PATH variable.我将它们添加到 PATH 变量中。 I done npm clear cache -force but nothing changed.我完成了npm clear cache -force但没有任何改变。

Removed node, npm, git with git bash and reinstalled them againt, and the error still present.用 git bash 删除了 node、npm、git 并重新安装了它们,但错误仍然存​​在。

this issue happened recently to many ppl earlier in the last 2 weeks , it seems like a problem withh package distrepution .这个问题最近在过去 2 周早些时候发生在许多人身上,这似乎是包分发的问题。

To fix this try cloning your library to different location .要解决此问题,请尝试将您的库克隆到不同的位置。 going into the packages/dscc-scripts directory and running the build command.进入packages/dscc-scripts 目录并运行构建命令。 You can then point all of the scripts from the package.json dscc-gen made to the packages/dscc-scripts/index.js file.然后,您可以将 package.json dscc-gen 中的所有脚本指向 packages/dscc-scripts/index.js 文件。 Bit of a hack, but good for the quick fix.有点黑客,但有利于快速修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM