运行npm时找不到npm-cli.js [英] npm-cli.js not found when running npm
问题描述
通常我可以使用 npm 安装库但是今天安装yeoman时我遇到了这个错误。请帮助弄清楚是什么原因。
Usually I can install a library using npm but today when installing yeoman I encountered this errors. Please help to figure out what's root cause.
D:\Works\phonegap\ionic\todo>npm install -g yo
module.js:340
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
我查看了文件夹:
C:\Program Files\\\
odejs\\\
ode_modules\\\
pm\bin\
C:\Program Files\nodejs\node_modules\npm\bin\
但看不到 node_modules 文件夹中描述的错误。
but don't see node_modules folder as the error described.
我也试图找到 npm-cli.js 并看到它实际上在 C:\Program Files\\\
odejs\\\
ode_modules\\\
pm\bin\
I also try to find npm-cli.js and see it's actually in C:\Program Files\nodejs\node_modules\npm\bin\
推荐答案
<事实证明问题是由于系统变量中节点的错误路径。该路径目前指向
It turns out the issue is due to wrong path of node in system variable. The path is currently point to
(我真的不知道我什么时候修改它)
(I really don't know when I modified it)
C:\Program Files\\\
odejs\\\
ode_modules\\\
pm\bin
C:\Program Files\nodejs\node_modules\npm\bin
所以我改为
C:\Program Files\\\
odejs
C:\Program Files\nodejs
它就像一个魅力。
这篇关于运行npm时找不到npm-cli.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!