Solution for npm ERR! enoent undefined ls-remote -h -t

Anna Coding
Anna Coding
Published in
1 min readAug 10, 2020

npm ERR! code ENOENT

npm ERR! syscall spawn git

npm ERR! path git

npm ERR! errno -2

npm ERR! enoent Error while executing

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

In DevOps, when run under node alpine docker image, you probably will get this error. The error here is in this line:

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

The right one should be

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

This means Git is undefined. If you add the following line to the docker file:

RUN git --version

💡💡The solution could be install Git by adding this line

RUN apk add --no-cache git

RUN git --version

--

--

Anna Coding
Anna Coding

Free web, mobile, DevOps, cloud tutorials, issues & solutions. www.annacoding.com