Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install returns syscall spawn git error

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?

like image 747
Chaitwo Avatar asked Nov 01 '19 12:11

Chaitwo


2 Answers

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

like image 62
yazantahhan Avatar answered Sep 17 '22 11:09

yazantahhan


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).

like image 24
DemiPixel Avatar answered Sep 17 '22 11:09

DemiPixel