angular error troubleshoot

npm ERR! enoent spawn git ENOENT

This tutorial guides you how to resolve npm error spawn git ENOENT when trying to install required dependencies from git.

Error: spawn git ENOENT

Let’s say in you Angular project’s package.json you have added some dependency for example, Phonegap local PDF-Viewer Android plugin for your project and tried running npm install which resulted in following error.

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/cyberkatze/pdfViewer.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\sneppets\AppData\Roaming\npm-cache\_logs20-05-06T05_37_37_180Z-debug.log

And your package.json looks like

----
"dependencies": {
 ------
 "de.cyberkatze.phonegap.plugin.PdfViewer": "git+https://github.com/cyberkatze/pdfViewer.git",
 ------
},
----

The following is the log trace (2020-05-06T05_37_37_180Z-debug.log) for some more details to understand the issue.

1356 error code ENOENT
1357 error syscall spawn git
1358 error path git
1359 error errno -4058
1360 error enoent Error while executing:
1360 error enoent undefined ls-remote -h -t https://github.com/cyberkatze/pdfViewer.git
1360 error enoent
1360 error enoent
1360 error enoent spawn git ENOENT
1361 error enoent This is related to npm not being able to find a file.
1362 verbose exit [ -4058, true ]

Analysis & Solution

Looking at the above log, the line 1358 error path git  says that when you ran npm install, it was trying to install PDF-Viewer phonegap plugin from Git repo using git command and it is unable to find git in your PATH.

So try git –version  and check whether you have installed Git or not. If you had already installed Git, make sure that it is available from the shell or command prompt so that you can install required cordova plugin.

Alternatively you can also remove this dependency from package.json and check whether your environment setup is having problem only with respect to Git installation. This is just to confirm.

Hope this suggestion helped you to resolve npm error spawn git ENOENT.

Also Read

References

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments