angular error troubleshoot

npm ERR! enoent – This is related to npm not being able to find a file

This tutorial guides you how to resolve error “npm ERR! enoent – This is related to npm not being able to find a file” that you are facing when you run npm install from Angular project directory.

npm ERR! enoent related to npm not being able to find a file

Are you facing error related to npm not being able to find a file after running npm install from the command prompt like below ? And do you find that after running npm install you don’t find any file or folder contents in the node_modules subfolder under Angular Project directory ?

E:\<Angular Project Directory Path>\> npm install
-------------------
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated [email protected]: This package no longer maintained, use 'cordova-plugin-document-viewer' instead.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: This module relies on Node.js's internals and will break at some point. Do not use it, and update to [email protected]
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
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_05_35_818Z-debug.log

The following are the contents of 2020-05-06T05_05_35_818Z-debug.log file.

1350 verbose stack Error: spawn git ENOENT
1350 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
1350 verbose stack     at onErrorNT (internal/child_process.js:467:16)
1350 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:84:21)
1351 verbose cwd E:\Nithi\Angular_workspace\vcsmobile-android_master
1352 verbose Windows_NT 6.3.9600
1353 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
1354 verbose node v13.12.0
1355 verbose npm  v6.14.4
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.

Therefore, npm install was interrupted and unable to proceed installing required dependencies. And there is a corruption in Angular packages during installation.

So that was the reason why node_modules folder was empty and throws “error enoent This is related to npm not being able to find a file”.

What you can do is first, try deleting node_modules manually. Then resolve any environment/setup related issues which is required to install required dependencies using package.json.

In our error case Git was not available from shell or command prompt to install cordova plugin. Make sure that Git is available from shell. Finally try npm install, it should install required packages without any issues.

Hope this suggestion helped.

Also Read

References

guest
0 Comments
Inline Feedbacks
View all comments