npm install shows error with git not found

岁酱吖の 提交于 2020-01-21 08:32:07

问题


enter image description hereI have recently added some dependencies to the package.JSON and tried installing npm . but it shows errors related to git nor found

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:

Image


回答1:


You need to install git in your machine to have it working.

undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git

it should have been

git ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git

There is error related to git path. check this ls-remote command




回答2:


In my case, I had Git installed, but it was only accessible from Git Bash (I had selected the first option below when installing). I reinstalled with the second option and it solved the issue:



来源:https://stackoverflow.com/questions/56473680/npm-install-shows-error-with-git-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!