安装nvm后无法卸载全局npm软件包

安装nvm后无法卸载全局npm软件包

问题描述:

我发现了几个与此问题相关的线程,但似乎没有一个专门针对我的情况,并且我无法使用发现的建议来解决.

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"

它只会返回:up to date in .043s -全局包仍然存在.

例如,我正在尝试uninstall 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.

这是在我卸载nodenpm并使用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 ls -g --depth=0上找到可以npm uninstall -g进行操作的列表.如果您没有看到要卸载的文件,但仍然可以访问它,那么如果它是npm安装的,则它可能是与您的节点的系统版本一起安装的.

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.