node.js npm权限问题try running this command again as root/Administrator.

时间:2021-11-24 12:47:10

npm install报错;

try running this command again as root/Administrator.

以管理员身份打开cmd

开始菜单-》所有程序-》附件,找到cmd,然后右键,以管理员身份运行。

看:http://blogs.msdn.com/b/matt-harrington/archive/2012/02/23/how-to-fix-node-js-npm-permission-problems.aspx

It turns out that you don’t have to run the command again as Administrator, and doing so won’t fix the problem.  Try npm cache clean first.  If that doesn’t fix things, take a look in%APPDATA%\npm-cache, or if you’re using PowerShell, $env:APPDATA\npm-cache.  After cleaning the cache, you may still be left with remnants.  Manually remove everything in that directory, and try again.  This has always fixed things for me.

一个回答:

在MAC上安装webpack以及reactjs等其它组件时,安装太慢卡住不动,直接ctrl+c终止后,再npm install后出npm WARN unmet dependency错误,npm cache clean后也不行。

解决方法是直接把当前的node_modules目录删除掉,重新npm install恢复正常。