npm install returns syscall spawn git error

22,106

Solution 1

Make sure you have the GIT installed on your device and accessible globally. Try to type git --version in the CMD. If it returned that the command is not recognized and GIT already installed, then you need to add it to the PATH environment variable and make sure to try the command using a new CMD session

Solution 2

If you're using a docker image, alpine version do not include git. Either switch to a non-alpine version (e.g. node:16 instead of node:16-alpine) or install git in another way (more info here).

Share:
22,106
Chaitwo
Author by

Chaitwo

Updated on April 22, 2022

Comments

  • Chaitwo
    Chaitwo about 2 years

    I've tried to run npm install and faced these issues below

    I've tried to clear cache with force command, install git and update node but nothing worked

    here is the error

    npm ERR! code ENOENT
    npm ERR! syscall spawn git
    npm ERR! path git
    npm ERR! errno ENOENT
    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:
    npm ERR!     C:\Users\UserName\AppData\Roaming\npm-cache\_logs\2019-11-01T11_56_42_862Z-debug.log
    

    Can someone help me resolve this?

  • Jeethesh Kotian
    Jeethesh Kotian about 4 years
    This is awesome. It worked for me. I installed git before install. Thanks.
  • Agent K
    Agent K about 3 years
    I believe now git --version is needed. My system is iMac using Visual Studio.