简体   繁体   English

npm 错误! 运行 npm install 时 enoent 未定义

[英]npm ERR! enoent undefined when running npm install

I used to run my Angular project in my windows 7 pc.我曾经在我的 Windows 7 pc 中运行我的 Angular 项目。 I installed Windows 2016 and all neceserry tools.我安装了 Windows 2016 和所有必需的工具。 I need to install the necessary dependencies for my angular project to run since I did not backup my node_modules folder.我需要为我的 angular 项目安装必要的依赖项才能运行,因为我没有备份我的 node_modules 文件夹。 When I run the command npm install I get the following error:当我运行命令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

I looked for solution on google added the Windows path variable %APPDATA%\\npm but it did not work.我在 google 上寻找解决方案添加了 Windows 路径变量%APPDATA%\\npm但它没有用。 The strange thing is I do not use FileSaver.js in my project.奇怪的是我没有在我的项目中使用 FileSaver.js。 How can I make npm install to work?如何让npm install工作?

This issue is caused because Git is either not installed or not available in a terminal.导致此问题的原因是 Git 未安装或在终端中不可用。 The give away is this line in your error log:赠品是错误日志中的这一行:

npm ERR! enoent spawn git ENOENT

Basically this means that the command git could not be executed because it was not found.基本上这意味着命令git无法执行,因为它没有被找到。

Make sure git is installed and added to your PATH before running this command again.在再次运行此命令之前,请确保 git 已安装并添加到您的 PATH 中。

I added我加了

RUN apk update
RUN apk add git 

into my dockerfile and it's now working.进入我的 dockerfile,它现在可以工作了。

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

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