I have NVM 0.30.1 and used it to install node.js v5.4.0 (with NPM 3.5.4) on Fedora 22. When I run npm update -g
, I receive the following warnings:
我有NVM 0.30.1,并使用它来安装节点。Fedora 22上的js v5.4.0(带有NPM 3.5.4)。当我运行npm更新-g时,我收到以下警告:
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > init-package-json with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > node-gyp with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npm-install-checks with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npmlog with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > read-package-json with new installed version
And after that, when I run npm I get this error:
在那之后,当我运行npm时,我得到了这个错误:
module.js:328
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at /home/peflorencio/.nvm/versions/node/v5.4.0/lib/node_modules/npm/bin/npm-cli.js:20:13
at Object.<anonymous> (/home/peflorencio/.nvm/versions/node/v5.4.0/lib/node_modules/npm/bin/npm-cli.js:76:3)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
Does anyone know what it is and how to solve it?
有谁知道它是什么以及如何解决它吗?
Thanks
谢谢
6 个解决方案
#1
5
Thanks for the answers. It was a bug and it has already been fixed in Node v5.4.1. Now it's working as usual.
谢谢你的答案。它是一个bug,它已经在Node v5.4.1中被修复了。现在一切正常了。
#2
4
It looks like npm update -g
cannot update npm to the newest version. I solve the problem by updating npm installation manually.
看起来npm更新-g不能更新npm到最新版本。我通过手动更新npm安装来解决这个问题。
- Install/ reinstall node to get the bundled npm
- 安装/重新安装节点以获得捆绑的npm。
- run
npm install -g npm@3.5.4
to update the global npm installation - 运行npm安装- gnpm@3.5.4来更新全局npm安装。
- now
npm update -g
should work - 现在npm更新-g应该起作用。
#3
3
What fixed this for me was
这对我来说是多么重要啊!
sudo rm -rf /usr/local/lib/node_modules/
and then re-installing node (with npm).
然后重新安装节点(与npm)。
#4
1
init-package-json, node-gyp, npm-install-checks, npmlog, read-package-json didn't installed correctly. Not sure why though.
init-package-json、node-gyp、npm-install-check、npmlog、read-package-json没有正确安装。虽然不知道为什么。
Didn't find the root cause for the issue but I used the hacky way to install the packages above for now:
没有找到问题的根本原因,但我现在用hacky方法安装了上面的包:
- Roll back to the previous node version which npm didn't be updated. For example,
nvm use iojs
- 回滚到npm没有更新的上一个节点版本。例如,nvm使用iojs。
-
cd
to where npm installed, for example,cd /home/peflorencio/.nvm/versions/node/v5.4.0/lib/node_modules/npm
and reinstall those packages likerm -rf node_modules/init-package-json && npm install init-package-json
etc. - cd到npm安装的地方,例如,cd /home/peflorencio/.nvm/版本/node/v5.4.0/lib/node_modules/npm,并重新安装这些包,如rm -rf node_modules/init-package-json && npm安装init-package-json等。
#5
1
I have faced the same issue in my Windows 10 PC. After looking into solutions, since i couldn't find the exact solution for the issue i was facing Cannot find module 'npmlog' I just uninstalled the node js and then, deleted both 'npm' and 'npm-cache' in "C:\Users\YourPCName\AppData\Roaming"
我在我的Windows 10电脑上也遇到过同样的问题。在寻找解决方案后,由于我找不到我所面临的问题的确切解决方案,所以我找不到模块的npmlog,我刚刚卸载了node js,然后在“C:\Users\YourPCName\AppData\”中删除了“npm”和“npm-cache”。
Then, i downloaded the latest version of node from Node JS Website
然后,我从node JS网站下载了最新版本的node。
And, installed node js
js,安装节点
After that i checked with the path in environment variables.
之后,我检查了环境变量中的路径。
Finally run the command prompt 'run as administrator' and npm install npm -g
最后运行命令提示符作为管理员,npm安装npm -g。
Checking your version will show the latest version. 'npm -v'
检查您的版本将显示最新版本。“npm - v”
I got the latest version - v3.10.9
我得到了最新版本的v3.10.9。
Try this. this should work.
试试这个。这应该工作。
#6
1
If people with linux are facing the problem, here is the solution:
如果有linux的人面临这个问题,这里有一个解决方案:
As of the date of this post, the NPM version packaged with Nodejs doesn't work. If you installed this package, run
在本文发布之日,NPM版本的Nodejs包并不起作用。如果您安装了这个包,运行。
sudo rm -rf /usr/local/bin/npm
sudo apt-get install node
sudo mv /usr/bin/npm /usr/local/bin/npm
New version should be 3.10.8 and the old error gone
新版本应该是3.10.8,旧错误消失了。
#1
5
Thanks for the answers. It was a bug and it has already been fixed in Node v5.4.1. Now it's working as usual.
谢谢你的答案。它是一个bug,它已经在Node v5.4.1中被修复了。现在一切正常了。
#2
4
It looks like npm update -g
cannot update npm to the newest version. I solve the problem by updating npm installation manually.
看起来npm更新-g不能更新npm到最新版本。我通过手动更新npm安装来解决这个问题。
- Install/ reinstall node to get the bundled npm
- 安装/重新安装节点以获得捆绑的npm。
- run
npm install -g npm@3.5.4
to update the global npm installation - 运行npm安装- gnpm@3.5.4来更新全局npm安装。
- now
npm update -g
should work - 现在npm更新-g应该起作用。
#3
3
What fixed this for me was
这对我来说是多么重要啊!
sudo rm -rf /usr/local/lib/node_modules/
and then re-installing node (with npm).
然后重新安装节点(与npm)。
#4
1
init-package-json, node-gyp, npm-install-checks, npmlog, read-package-json didn't installed correctly. Not sure why though.
init-package-json、node-gyp、npm-install-check、npmlog、read-package-json没有正确安装。虽然不知道为什么。
Didn't find the root cause for the issue but I used the hacky way to install the packages above for now:
没有找到问题的根本原因,但我现在用hacky方法安装了上面的包:
- Roll back to the previous node version which npm didn't be updated. For example,
nvm use iojs
- 回滚到npm没有更新的上一个节点版本。例如,nvm使用iojs。
-
cd
to where npm installed, for example,cd /home/peflorencio/.nvm/versions/node/v5.4.0/lib/node_modules/npm
and reinstall those packages likerm -rf node_modules/init-package-json && npm install init-package-json
etc. - cd到npm安装的地方,例如,cd /home/peflorencio/.nvm/版本/node/v5.4.0/lib/node_modules/npm,并重新安装这些包,如rm -rf node_modules/init-package-json && npm安装init-package-json等。
#5
1
I have faced the same issue in my Windows 10 PC. After looking into solutions, since i couldn't find the exact solution for the issue i was facing Cannot find module 'npmlog' I just uninstalled the node js and then, deleted both 'npm' and 'npm-cache' in "C:\Users\YourPCName\AppData\Roaming"
我在我的Windows 10电脑上也遇到过同样的问题。在寻找解决方案后,由于我找不到我所面临的问题的确切解决方案,所以我找不到模块的npmlog,我刚刚卸载了node js,然后在“C:\Users\YourPCName\AppData\”中删除了“npm”和“npm-cache”。
Then, i downloaded the latest version of node from Node JS Website
然后,我从node JS网站下载了最新版本的node。
And, installed node js
js,安装节点
After that i checked with the path in environment variables.
之后,我检查了环境变量中的路径。
Finally run the command prompt 'run as administrator' and npm install npm -g
最后运行命令提示符作为管理员,npm安装npm -g。
Checking your version will show the latest version. 'npm -v'
检查您的版本将显示最新版本。“npm - v”
I got the latest version - v3.10.9
我得到了最新版本的v3.10.9。
Try this. this should work.
试试这个。这应该工作。
#6
1
If people with linux are facing the problem, here is the solution:
如果有linux的人面临这个问题,这里有一个解决方案:
As of the date of this post, the NPM version packaged with Nodejs doesn't work. If you installed this package, run
在本文发布之日,NPM版本的Nodejs包并不起作用。如果您安装了这个包,运行。
sudo rm -rf /usr/local/bin/npm
sudo apt-get install node
sudo mv /usr/bin/npm /usr/local/bin/npm
New version should be 3.10.8 and the old error gone
新版本应该是3.10.8,旧错误消失了。