[英]npm ERR! enoent undefined when running 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 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 已安裝並添加到您的 PATH 中。
我加了
RUN apk update
RUN apk add git
進入我的 dockerfile,它現在可以工作了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.