npm ERR!运行npm install时enoent undefined

时间:2019-07-11 10:57:32

标签: node.js angular npm-install

我曾经在Windows 7 pc中运行Angular项目。我安装了Windows 2016和所有neceserry工具。由于我没有备份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正常工作?

3 个答案:

答案 0 :(得分:1)

由于未安装Git或终端中不存在Git而导致此问题。赠送的是您的错误日志中的这一行:

npm ERR! enoent spawn git ENOENT

基本上,这意味着命令git因为找不到而无法执行。

在再次运行此命令之前,请确保已安装git并将其添加到PATH中。

答案 1 :(得分:0)

npm ERR! enoent This is related to npm not being able to find a file.

This blog by Jose Quinto回答了类似的情况,这是我面临的一个问题。

答案 2 :(得分:0)

我添加了

RUN apk update
RUN apk add git 

进入我的 dockerfile,它现在可以工作了。

相关问题