NPM:运行npm时找不到npm-cli.js [英] NPM: 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 \ nodejs \ node_modules \ npm \ 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 \ nodejs \ node_modules \ npm \ 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 the wrong path of node in system variable. The path is currently pointing to
(我真的不知道我何时对其进行修改)
(I really don't know when I modified it)
C:\Program Files\nodejs\node_modules\npm\bin
所以我更改为
C:\Program Files\nodejs
,它就像一种魅力.
这篇关于NPM:运行npm时找不到npm-cli.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!