安装nvm后无法卸载全局npm包 [英] Can't uninstall global npm packages after installing nvm
问题描述
我发现了几个与此问题相关的线程,但似乎没有一个专门针对我的案例,而且我一直无法使用我找到的建议解决问题.
I've found several threads related to this issue but none seem to deal with my case specifically and I've been unable to solve using the suggestions I've found.
当我运行 npm uninstall -g "some package"
它只是返回:更新在 .043 秒内
- 并且全局包仍然存在.
例如我正在尝试卸载 babel-cli
并且在 running npm uninstall -g babel-cli
之后我仍然可以使用 cli代码>.
For example I'm trying to uninstall babel-cli
and after running npm uninstall -g babel-cli
I'm still able to use the cli
.
这是在我卸载 node
和 npm
并使用 nvm
重新安装后开始的.我想知道我在卸载 node
时是否遗漏了什么,这导致了问题.我检查了我的点文件,注意到我在 .nvm
之外还有一个 .npm
.这是正常的吗?提前感谢您的任何建议.
This started after I uninstalled node
and npm
and reinstalled using nvm
. I'm wondering if I missed something while uninstalling node
and it's causing the issue. I checked my dot files and noticed I still have a .npm
outside of .nvm
. Is that normal? Thanks in advance for any suggestions.
推荐答案
(nvm 维护者在此)
(nvm maintainer here)
您可以npm uninstall -g
的内容列表可在npm ls -g --depth=0
处获得.如果你在那里没有看到你想卸载的东西,但你仍然可以访问它,那么如果它是 npm 安装的,它可能是用你的系统版本的 node 安装的.
The list of things that you can npm uninstall -g
is available at npm ls -g --depth=0
. If you don't see the thing you want to uninstall there, but you can still access it, then if it was npm-installed, it was probably installed with your system version of node.
您可以使用 nvm use system && 快速验证这一点npm ls -g --depth=0
.如果你在那里看到这个包,那么在使用系统版本时,你可以npm uninstall -g
它.
You can quickly verify this with nvm use system && npm ls -g --depth=0
. If you see the package there, then while using the system version, you can npm uninstall -g
it.
这篇关于安装nvm后无法卸载全局npm包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!