How to uninstall global package with npm?

I have installed webpack in this way:

npm install -g webpack

Now want to uninstall it:

npm uninstall -g webpack

Check it again, it didn't been uninstalled:

webpack -v
3.1.0

Why?


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

npm list -g | grep webpack

This also didn't work:

npm uninstall -g webpack --save

After run this under a directory which included package.json:

npm uninstall webpack
npm WARN [email protected] requires a peer of webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc but none was installed.
npm WARN [email protected] requires a peer of uglify-js@^2.8.0 but none was installed.
npm WARN [email protected] requires a peer of webpack@^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc but none was installed.

Solution 1:

Try running both of the below commands:

npm uninstall -g webpack
npm uninstall webpack

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

Solution 2:

npm uninstall -g webpack

Worked for me, try running the command prompt in administrator mode.