npm install shows error with git not found

21,123

Solution 1

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

Solution 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:

enter image description here

Share:
21,123

Related videos on Youtube

Harikrishnan C U
Author by

Harikrishnan C U

Updated on July 09, 2022

Comments

  • Harikrishnan C U
    Harikrishnan C U almost 2 years

    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

    • Shashank Vivek
      Shashank Vivek almost 5 years
      Do you have git installed ? The error is from undefined ls-remote which should be git ls-remote
    • Harikrishnan C U
      Harikrishnan C U almost 5 years
      is it essential to install git?
    • Shashank Vivek
      Shashank Vivek almost 5 years
      Yes, you need to have git installed
    • phd
      phd almost 5 years
    • phd
      phd almost 5 years
    • alextc
      alextc almost 5 years
      Also make sure "run command prompt as administrator". This worked for me.
  • Pauloco
    Pauloco about 4 years
    Same here. And don't forget to reboot, otherwise the git command won't be available in the cmd.
  • jon
    jon about 2 years
    reboot !!! haaaaaaaaa