以下是我使用的命令:
➜ code npm ls
/Users/ravindrakumar/code
└── (empty)
➜ code npm ls -g
➜ code npm install coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
coffee-script@1.6.3 node_modules/coffee-script
➜ code npm rm coffee-script
unbuild coffee-script@1.6.3
➜ code npm install -g coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
/Users/ravindrakumar/code/Password:/usr/local/bin/coffee -> /Users/ravindrakumar/code/Password:/usr/local/lib/node_modules/coffee-script/bin/coffee
/Users/ravindrakumar/code/Password:/usr/local/bin/cake -> /Users/ravindrakumar/code/Password:/usr/local/lib/node_modules/coffee-script/bin/cake
coffee-script@1.6.3 /Users/ravindrakumar/code/Password:/usr/local/lib/node_modules/coffee-script
➜ code npm -g ls
/Users/ravindrakumar/code/Password:/usr/local/lib
└── coffee-script@1.6.3
➜ code ls Password:
usr
➜ code ls Password:/usr
local
➜ code ls Password:/usr/local
bin lib
➜ code ls Password:/usr/local/bin
cake coffee
➜ code ls Password:/usr/local/lib
node_modules
➜ code ls Password:/usr/local/lib/node_modules
coffee-script
➜ code rm -rf Password:
➜ code npm -g ls
➜ code
我尝试卸载节点,完全使用npm https://gist.github.com/nicerobot/2697848 但在重新安装后我又遇到了同样的问题。
我也在github中创建了一个问题,但仍然没有回复 https://github.com/isaacs/npm/issues/3922
答案 0 :(得分:0)
我通过更改全局npm配置修复了它
➜本地git :(主)✗npmconfig ls -l | grep配置 ; cli configs ; globalconfig / usr / local / etc / npmrc ;内置配置未定义 globalconfig =" / usr / local / etc / npmrc" userconfig =" /Users/ravindrakumar/.npmrc"
➜本地git :(主)✗cat/ usr / local / etc / npmrc prefix =密码:/ usr / local
我编辑npmrc现在它正常工作