0

I have all the required packages to run node and angular app. Everything was working fine and out of nowhere all hell broke loose. Now, when I try to run npm install to install all the dependencies of the project, I get the following issue:

$ npm install
module.js:540
    throw err;
    ^
Error: Cannot find module 'C:\Program Files\Git\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

and when I try to create a new angular app, I get the following error:

ng new angular-app
module.js:540
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\Git\node_modules\@angular\cli\bin\ng'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

Here's my PATH env variable:

C:\ProgramData\Oracle\Java\javapath;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\VG\Utils;
C:\Program Files (x86)\Lotus\Notes;
c:\oracle32\ora121\bin;
C:\Oracle64\ora121\bin;
C:\PROGRA~2\IBM\SQLLIB\BIN;
C:\PROGRA~2\IBM\SQLLIB\FUNCTION;
C:\PROGRA~2\IBM\SQLLIB\SAMPLES\REPL;
C:\PROGRA~2\ibm\gsk8\lib;
C:\Program Files\IBM\WebSphere MQ\Java\lib;
C:\Program Files (x86)\apache-maven-3.2.5\bin;
C:\Program Files (x86)\Java\jdk1.8.0\bin;
C:\Program Files\nodejs\;
C:\Program Files\Microsoft VS Code\bin;
C:\Program Files\Git\cmd;
C:\Users\UNBP\AppData\Local\Microsoft\WindowsApps;
C:\Users\UNBP\AppData\Roaming\npm
PATHEXT=.COM;
.EXE;
.BAT;
.CMD;
.VBS;
.VBE;
.JS;
.JSE;
.WSF;
.WSH;
.MSC

I have gone through all the posts here npm-cli.js not found when running npm, but that didn't solve my issue.

Pritam Bohra
  • 3,912
  • 8
  • 41
  • 72
  • `C:\Program Files\Git\cmd;` remove `cmd` – Gonzalo Lorieto Nov 28 '18 at 15:13
  • run the commands `npm --version` and `ng --version` and check if these commands return a version. This is to make sure that you have `@angular/cli` and `npm` installed. – SiddAjmera Nov 28 '18 at 15:33
  • @SiddAjmeraI am getting proper response for the above commands. Those commands do not work in VS Code and give the same error but the commands work in cmd in Windows. Not really sure what's happening here – Pritam Bohra Nov 28 '18 at 15:51

0 Answers0