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 · 39 comments
Closed

How to uninstall nvm? #298

mehulkar opened this issue Sep 24, 2013 · 39 comments

Comments

@mehulkar
Copy link

@mehulkar mehulkar commented Sep 24, 2013

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

@ljharb
Copy link
Member

@ljharb 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 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

@mehulkar mehulkar closed this Dec 16, 2013
@koenpunt
Copy link
Contributor

@koenpunt koenpunt commented Dec 16, 2013

@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 mibamur commented Dec 16, 2013

@koenpunt yeh, you right

@mehulkar
Copy link
Author

@mehulkar mehulkar commented Dec 16, 2013

Thank you!

@ljharb
Copy link
Member

@ljharb 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

@koenpunt koenpunt commented Dec 16, 2013

@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 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

@scott-joe scott-joe commented Oct 29, 2015

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 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 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 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 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 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 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

@michaeltyhuang michaeltyhuang commented Feb 23, 2016

@ljharb it works

@chovy
Copy link

@chovy chovy commented Sep 8, 2016

can we get an nvm uninstall-nvm command?

@ljharb
Copy link
Member

@ljharb 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 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 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 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 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 myisjon commented Apr 23, 2017

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

@ljharb
Copy link
Member

@ljharb 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

@FranklinYu FranklinYu commented Aug 2, 2017

How about adding this in README?

@cdock1029
Copy link

@cdock1029 cdock1029 commented Mar 29, 2018

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...

@FranklinYu
Copy link

@FranklinYu FranklinYu commented Mar 29, 2018

#1134 did it, but it has not yet been merged.

@ayuthmang

This comment has been hidden.

@ljharb

This comment has been hidden.

@Vadorequest
Copy link

@Vadorequest Vadorequest commented Feb 10, 2019

One hard thing to remember is how nvm was installed in the first place. I thought I had used homebrew (glad I didn't), but I used wget instead. I wonder if there is a way to know afterwards how nvm was installed.

I ran into another issue and saw that issue which helped me understand things out.
See https://stackoverflow.com/questions/34718528/nvm-is-not-compatible-with-the-npm-config-prefix-option
See https://stackoverflow.com/a/54617989/2391795 for how to reinstall nvm

@FranklinYu
Copy link

@FranklinYu FranklinYu commented Feb 11, 2019

@Vadorequest If everything is in ~/.nvm then it is installed with the official installation script.

@dorkmania
Copy link

@dorkmania dorkmania commented Jul 15, 2019

In addition to rm -rf /root/.nvm if someone accidentally installed nvm as 'root' and is trying to reinstall it as a user you might also want to remove the following lines from /root/.bashrc

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
@ljharb
Copy link
Member

@ljharb ljharb commented Jul 15, 2019

Note tho that those lines are safe noops if you’ve deleted the dir.

@dorkmania
Copy link

@dorkmania dorkmania commented Jul 15, 2019

@ljharb export NVM_DIR="$HOME/.nvm" this line in particular wasn't letting me install nvm as a user with wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash even after I deleted the nvm directory and reloaded my shell. I couldn't reboot the server though as it's Production.

@ljharb
Copy link
Member

@ljharb ljharb commented Jul 15, 2019

hmm, I’m not sure why a root env var would persist in a non-root session, but fair enough.

@FranklinYu
Copy link

@FranklinYu FranklinYu commented Jul 15, 2019

@dorkmania You don’t have to reboot, just log in again (as non-root user, of course).

@dorkmania
Copy link

@dorkmania dorkmania commented Jul 15, 2019

@FranklinYu maybe it was just CloudLinux acting weird but I couldn't reinstall even after closing my ssh connection, re-logging in to root and then changing to the user account; till I deleted that line. The script kept giving me a message along the lines of $NVM_DIR set to "/root/.nvm" before stopping. (.nvm was already deleted)

@FranklinYu
Copy link

@FranklinYu FranklinYu commented Jul 15, 2019

@dorkmania You are not logging into the user account when you first login as root and switch user. The first user matters. Contact your cloud provider if they don’t provide direct access to non-root user login session, or this will bite you here and there.

@dorkmania
Copy link

@dorkmania dorkmania commented Jul 15, 2019

@FranklinYu Makes sense.

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

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.