尽管已设置npm和正确的路径,但npm install和ng serve命令无法正常工作

时间:2018-11-28 14:58:03

标签: node.js angular npm npm-cli

我拥有运行节点和angular应用程序所需的所有软件包。一切都运转良好,无处不散。现在,当我尝试运行npm install安装项目的所有依赖项时,出现以下问题:

$ 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

,当我尝试创建新的角度应用程序时,出现以下错误:

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

这是我的PATH env变量:

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

我浏览了npm-cli.js not found when running npm处的所有帖子,但这并不能解决我的问题。

0 个答案:

没有答案