Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to uninstall nvm? #298

Closed
mehulkar opened this issue Sep 24, 2013 · 65 comments
Closed

How to uninstall nvm? #298

mehulkar opened this issue Sep 24, 2013 · 65 comments

Comments

@mehulkar
Copy link

I want to uninstall nvm completely. Is there documentation on how to do this?

@ljharb
Copy link
Member

ljharb commented Sep 25, 2013

Essentially you'd need to reverse the steps in install.sh - remove any nvm lines from ~/.bash_profile (and/or ~/.profile), rm -rf ~/.nvm, and either reopen your shell, or re-source your bash profile.

However, simply removing the nvm commands from your .bash_profile or .profile should be more than sufficient.

@mibamur
Copy link
Contributor

mibamur commented Dec 15, 2013

@mehulkar

just remove directory

rm -rf ~/.nvm
rm -rf ~/.npm
rm -rf ~/.bower

and as ljharb say find and remove line source ~/.nvm from yours .bashrc or .zshrc

@creationix please close this issue

@koenpunt
Copy link
Contributor

@mibamur There is no need for such emphasis in your comments. And it is probably better to use the $NVM_DIR variable, as not everyone has nvm installed in ~/.nvm.

Oneliner:

rm -rf $NVM_DIR ~/.npm ~/.bower

@mibamur
Copy link
Contributor

mibamur commented Dec 16, 2013

@koenpunt yeh, you right

@mehulkar
Copy link
Author

Thank you!

@ljharb
Copy link
Member

ljharb commented Dec 16, 2013

To ensure this isn't found by someone unwitting: you do not need to do anything to ~/.npm or ~/.bower - you'll be needlessly blowing away caches.

To uninstall npm with the smallest possible impact, only remove the source lines from your profile. You may also rm -rf $NVM_DIR if you like but it's not necessary.

@koenpunt
Copy link
Contributor

@ljharb Ah you're right, it's about uninstalling nvm, not node. Although by removing the nvm directory you'll remove node as well.

@ljharb
Copy link
Member

ljharb commented Dec 16, 2013

@koenpunt not if node is also installed globally. I install node from source globally (which is simply running 4 commands in the repo) but use nvm to manage it for my user profile, and I definitely run shells with nvm deactivate so I can use my global node.

@scott-joe
Copy link

For additional info, nvm may be installed via Homebrew or npm. Check your installed packages for the proper way to remove the binary files.

@ljharb
Copy link
Member

ljharb commented Oct 29, 2015

@scott-joe nvm should never be installed via homebrew - it's entirely unsupported. See #469. In addition, the nvm on npm is NOT the correct one, and will not work anyways - see #304.

@trusktr
Copy link

trusktr commented Jan 5, 2016

What's the reasoning for not hosting nvm on npm? This would make nvm easy to uninstall with npm uninstall -g nvm.

@ljharb
Copy link
Member

ljharb commented Jan 5, 2016

@trusktr it's not "reasoning", it's that it's a different project that's now deprecated. I've been given ownership of it, and at some point in the future (see #304), I'll replace it with something that bootstraps the proper nvm.

Also, when using nvm, npm is managed by nvm. Uninstalling nvm would delete npm. Why would it make any sense to uninstall nvm with a tool that nvm installed for you?

@trusktr
Copy link

trusktr commented Jan 5, 2016

It might not make sense. It'd just be nice to uninstall it easily. Maybe it can prompt at the command like something like "This will uninstall versions of node installed by nvm too. Continue?".

@trusktr
Copy link

trusktr commented Jan 5, 2016

Wait, I'm not even sure that's possible. Oh well, I was able to remove it manually any ways, and I can use Arch Linxu's pacman to see which files don't belong to any package and remove those too.

@ljharb
Copy link
Member

ljharb commented Jan 5, 2016

it's pretty simple. rm -rf $NVM_DIR and remove the two lines in your profile file.

@michaeltyhuang
Copy link

@ljharb it works

@ralyodio
Copy link

ralyodio commented Sep 8, 2016

can we get an nvm uninstall-nvm command?

@ljharb
Copy link
Member

ljharb commented Sep 8, 2016

@chovy that would require modifying one or more of your profile files, otherwise it'd just be rm -rf "$NVM_DIR" - that's pretty destructive, and not something I'd want to encourage.

Disk space is cheap, so the best way to uninstall it is to simply disable it by removing the sourcing lines from your profile files - which has to be done manually.

@jcubic
Copy link

jcubic commented Jan 2, 2017

I've removed the directory (on Windows 7) and I still can execute nvm from git bash, what going on?

@ljharb
Copy link
Member

ljharb commented Jan 2, 2017

@jcubic you may need to restart git bash and/or Windows. Sourced shell functions stay in memory even if the files are deleted.

@hzbd
Copy link

hzbd commented Mar 30, 2017

step1 - check env:

[root@demo tatia]# echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/.nvm/versions/node/v6.2.2/bin

step2 (remove nvm env from envs):

export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

then, remove /root/.nvm/*
done.

@ljharb
Copy link
Member

ljharb commented Mar 30, 2017

@sconts to uninstall, yes. when installed, however, the nvm paths should be first, or else it won't work properly. (however, nvm unload and nvm deactivate both remove it for you)

@myisjon
Copy link

myisjon commented Apr 23, 2017

rm -rf $NVM_DIR ~/.npm ~/.bower && unset NVM_DIR

@ljharb
Copy link
Member

ljharb commented Apr 23, 2017

@myisjon ~/.npm and ~/.bower are for npm and bower, respectively; you don't necessarily want to ~/.npm when removing nvm. (of course, you'll want to remove bower in every case)

@FranklinYu
Copy link

How about adding this in README?

@cdock1029
Copy link

Please add uninstall instructions to the README. One preference for using package managers to install node or anything else is ease of removal. Should be explicitly defined somewhere the best practice in completely removing it...

@ljharb
Copy link
Member

ljharb commented Jan 22, 2021

@xahon it would be very dangerous to mess with your profile files. The most an nvm command could safely do is rm -rf $NVM_DIR, so you'd still end up running a single command, and then manually deleting 2-3 lines from a profile file.

@xahon
Copy link

xahon commented Jan 22, 2021

@ljharb fzf has an utility to remove itself in a safe manner. Also user can override NVM_DIR by some reason and it is not safe to do rm -rf $NVM_DIR too

@ljharb
Copy link
Member

ljharb commented Jan 22, 2021

It’s quite safe; and any user who overrides NVM_DIR would cause nvm to delete the overridden dir anyways, since that’s the only way nvm knows where it lives.

i can’t speak for fzf or any other tool; the current requirements are one rm command, and optionally deleting 2-3 lines from your profile file. There’s nowhere close to enough incremental value from an uninstall command to risk it.

@MuhammadUmairMoosani
Copy link

work for me in macos
rm -rf ~/.nvm
brew cleanup --prune-prefix

@molnarjoe
Copy link

I too am trying to remove all of nvm, npm, and node. After following advice above, I don't believe I have completely uninstalled everything. For example, I still see:
/usr/lib/node_modules
/usr/lib/node_modules/npm/node_modules
/usr/lib/node_modules/npm/node_modules/debug/node_modules
/usr/lib/node_modules/npm/node_modules/cli-table3/node_modules
/usr/lib/node_modules/npm/node_modules/npmlog/node_modules
/usr/lib/node_modules/npm/node_modules/request/node_modules
/usr/lib/node_modules/npm/node_modules/string-width/node_modules
/usr/lib/node_modules/npm/node_modules/node-gyp
/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules
/usr/lib/node_modules/npm/node_modules/.bin/node-which
/usr/lib/node_modules/npm/node_modules/.bin/node-gyp
/usr/src/linux-headers-5.11.0-37-generic/include/config/nvm
/usr/src/linux-headers-5.11.0-36-generic/include/config/nvm
/usr/lib/node_modules/npm

If I want to start afresh with nodejs, what is the advice about removing node_modules and the rest I found?
For example the contents of /usr/lib/node_modules/npm/node_modules really concerns me. Ton of stuff...

@ljharb
Copy link
Member

ljharb commented Oct 5, 2021

@molnarjoe rm -rf /usr/lib/node_modules. I have no idea what /usr/src/linux-headers-5.11.0-36-generic/include/config/nvm is; that's not part of this project whatsoever.

@Maxlo27
Copy link

Maxlo27 commented Mar 10, 2022

@mibamur There is no need for such emphasis in your comments. And it is probably better to use the $NVM_DIR variable, as not everyone has nvm installed in ~/.nvm.

Oneliner:

rm -rf $NVM_DIR ~/.npm ~/.bower

then restart your terminal and check🙂

@av8ta

This comment was marked as abuse.

@OkilyDokily

This comment was marked as off-topic.

@ljharb

This comment was marked as resolved.

@OkilyDokily

This comment was marked as resolved.

@JSSAggie
Copy link

This was helpful
https://www.linode.com/docs/guides/how-to-install-use-node-version-manager-nvm/#nvm-uninstall-steps

@Barabba11
Copy link

no one of above removed my nvm. No bash script for it?
i can't get rid of it!!

@av8ta

This comment was marked as resolved.

@ljharb

This comment was marked as resolved.

@ljharb
Copy link
Member

ljharb commented Nov 16, 2022

@Barabba11 removing nvm is a two step process - rm -rf $NVM_DIR, and then optionally remove the nvm lines from your profile file.

@Barabba11
Copy link

@Barabba11 removing nvm is a two step process - rm -rf $NVM_DIR, and then optionally remove the nvm lines from your profile file.

Did't work, pobably because it was not properly configured in PATH, so I removed it under root folder and now I can installa Node Red. Thanks

@ljharb
Copy link
Member

ljharb commented Nov 16, 2022

Having nvm installed shouldn't interfere with any kind of system node, whether node red or otherwise. nvm deactivate or nvm use system should be sufficient to allow that to work.

@rick3500
Copy link

rick3500 commented Mar 7, 2023

you could also check to see if you have an .npmrc file in your home or $NVM_DIR. if there is a reference there to a registry, IF you are having issues with package resolution, it could be intercepting the call.

@Feyem9
Copy link

Feyem9 commented Jun 25, 2023

and how to fine the $NVM_DIR .

@ljharb
Copy link
Member

ljharb commented Jun 25, 2023

@Feyem9 it’s an env var. By default it’ll be $HOME/.nvm, but you can just check its value.

@dutscher
Copy link

nvm unload and its removed from shell

@matheusjordan
Copy link

nvm unload and its removed from shell

this removed nvm from comand line but files still on /root/.nvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests