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.
When I run npm uninstall -g "some package"
it just returns: up to date in .043s
- And the global package remains.
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
.
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.
A global package is a package that is installed globally on your machine, so you don't have to reinstall it every you need it. To remove a global package, you need to attach the -g flag to npm uninstall, and then specify the name of the package. The basic syntax for doing this is npm uninstall -g package-name .
Uninstalling global packages To uninstall an unscoped global package, on the command line, use the uninstall command with the -g flag. Include the scope if the package is scoped.
Use NVM to Uninstall Node NVM allows you to uninstall Node versions that are no longer required. Run the command nvm uninstall with the version of Node you'd like to remove. You cannot remove a version you are currently using, so you must switch to a different version first.
(nvm maintainer here)
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.
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.
Sorry I know this is an old question but here we are in 2019 and was just an issue for me ... what I found is that I needed to invoke uninstall on the npm at the path that NVM cares about.
Here's what worked for me:
Tue Aug 20 08:09:07 ~ <username> $ npm uninstall -g [email protected] up to date in 0.051s Tue Aug 20 08:09:13 ~ <username> $ edgemicro --version current nodejs version is v8.16.0 current edgemicro version is 3.0.4 3.0.4 // Clearly didn’t work :( // Let’s try sudo …. Tue Aug 20 08:09:18 ~ <username> $ sudo npm uninstall -g [email protected] Password: up to date in 0.035s Tue Aug 20 08:10:20 ~ <username> $ edgemicro --version current nodejs version is v8.16.0 current edgemicro version is 3.0.4 3.0.4 // Still didn’t work :( // So where is this seemingly immortal executable? Tue Aug 20 08:10:28 ~ <username> $ which edgemicro /Users/<username>/.nvm/versions/node/v8.16.0/bin/edgemicro // It’s under some NVM specific path it seems. // It seems NPM is also under some NVM specific path, kinda expected. Tue Aug 20 08:10:33 ~ <username> $ which npm /Users/<username>/.nvm/versions/node/v8.16.0/bin/npm // So let’s use that exact npm to perform the uninstall … Tue Aug 20 08:10:42 ~ <username> $ /Users/<username>/.nvm/versions/node/v8.16.0/bin/npm uninstall -g edgemicro npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I'll try to do my best with it! removed 2442 packages in 25.851s Tue Aug 20 08:11:24 ~ <username> $ which edgemicro Tue Aug 20 08:11:29 ~ <username> $ // Done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With