如何使用 npm 卸载全局包?

问题描述:

我是这样安装webpack的:

I have installed webpack in this way:

npm install -g webpack

现在想卸载它:

npm uninstall -g webpack

再次检查,它没有被卸载:

Check it again, it didn't been uninstalled:

webpack -v
3.1.0

为什么?

而且,我用这种方式找不到webpack:

And, I use this way can't find webpack:

npm list -g | grep webpack

这也不起作用:


This also didn't work:

npm uninstall -g webpack --save

在包含 package.json 的目录下运行后:

npm uninstall webpack
npm WARN babel-loader@6.4.1 requires a peer of webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc but none was installed.
npm WARN uglifyjs-webpack-plugin@0.3.1 requires a peer of uglify-js@^2.8.0 but none was installed.
npm WARN uglifyjs-webpack-plugin@0.3.1 requires a peer of webpack@^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc but none was installed.

尝试运行以下两个:

npm uninstall -g webpack
npm uninstall webpack

我认为您可能会在仅删除全局版本后检查/查看本地版本.

I think you might be checking/lloking at the local version after deleting only the global one.