Node.js npm错误!运行npm安装时eNONT未定义

Node.js npm错误!运行npm安装时eNONT未定义,node.js,angular,npm-install,Node.js,Angular,Npm Install,我曾经在windows 7 pc上运行Angular项目。我安装了windows 2016和所有必要的工具。我需要安装运行angular项目所需的依赖项,因为我没有备份我的node_modules文件夹。运行命令npm install时,出现以下错误: C:\Angular_Prj>npm install npm ERR! path git npm ERR! code ENOENT npm ERR! errno ENOENT npm ERR! syscall spawn git npm E

我曾经在windows 7 pc上运行Angular项目。我安装了windows 2016和所有必要的工具。我需要安装运行angular项目所需的依赖项,因为我没有备份我的node_modules文件夹。运行命令
npm install
时,出现以下错误:

C:\Angular_Prj>npm install
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-07-11T09_48_53_918Z-debug.log

我在google上寻找解决方案,添加了Windows路径变量
%APPDATA%\npm
,但它不起作用。奇怪的是我没有在我的项目中使用FileSaver.js。如何使npm install正常工作?

此问题是由于Git未安装或在终端中不可用而导致的。您的错误日志中的这一行显示了泄漏:

npm ERR! enoent spawn git ENOENT
基本上这意味着无法执行命令
git
,因为找不到它

再次运行此命令之前,请确保git已安装并添加到您的路径中。

I添加

RUN apk update
RUN apk add git 

进入我的dockerfile,它现在正在工作。

您是否已在终端中安装并提供git?很明显,终端中没有git。我必须添加路径
C:\ProgramFiles\Git
,才能使其正常工作。非常感谢你。如果你写一个答案而不是评论,我可以把它标记为接受答案。很高兴听到它被解决了。我添加了一个答案。这也是我的解决方案,但我忘记重新启动IDE(WebStorm),所以它不知道新安装的
git
命令行工具。因此,如果问题在安装git后仍然存在,请记住重新启动IDE/终端。