Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install shows error with git not found

I have recently added some dependencies to the package JSON and tried installing npm, but it shows errors related to git not 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://[email protected]/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

like image 668
Harikrishnan C U Avatar asked Jun 06 '19 08:06

Harikrishnan C U


People also ask

Why npm install showing error?

code 1 error usually occurs when you run the npm install command. This cause of this error is that one of the dependencies you define in your package. json file fails to be installed properly on your computer. This means that npm fails to install the node-sass module that's added as a dependency to the n-app project.

Can you install Git with npm?

npm install git doesn't install git (i.e. the command line tool to manipulate git repositories). It installs the npm package called git which seems to be a JavaScript library to interact with git repositories (which makes the name accurate, but still misleading). npm is not a general-purpose package manager.


2 Answers

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

undefined ls-remote -h -t ssh://[email protected]/eligrey/FileSaver.js.git

it should have been

git ls-remote -h -t ssh://[email protected]/eligrey/FileSaver.js.git

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

like image 137
Shashank Vivek Avatar answered Oct 14 '22 08:10

Shashank Vivek


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:

enter image description here

like image 11
Saeb Amini Avatar answered Oct 14 '22 06:10

Saeb Amini