Closed mehulkar closed 10 years ago
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.
@mehulkar
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
@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
@koenpunt yeh, you right
Thank you!
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.
@ljharb Ah you're right, it's about uninstalling nvm, not node. Although by removing the nvm directory you'll remove node as well.
@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.
For additional info, nvm may be installed via Homebrew or npm. Check your installed packages for the proper way to remove the binary files.
@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.
What's the reasoning for not hosting nvm on npm? This would make nvm easy to uninstall with npm uninstall -g nvm
.
@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?
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?".
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.
it's pretty simple. rm -rf $NVM_DIR
and remove the two lines in your profile file.
@ljharb it works
can we get an nvm uninstall-nvm
command?
@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.
I've removed the directory (on Windows 7) and I still can execute nvm from git bash, what going on?
@jcubic you may need to restart git bash and/or Windows. Sourced shell functions stay in memory even if the files are deleted.
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.
@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)
rm -rf $NVM_DIR ~/.npm ~/.bower && unset NVM_DIR
@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)
How about adding this in README?
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...
Finally, I can fixed it by uninstalling the nvm (previously version is v0.33.11) and install nvm from homebrew (actually I want everything managed with brew) and following the instruction.
By uninstalling using #1134
rm -rf $NVM_DIR ~/.npm ~/.bower
To install nvm via curl (as @ljharb recommended to me brew is not strongly recommended to install nvm)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
Now it can solved my problem since last week.
@blacksourcez nvm is explicitly not supported via homebrew; i strongly suggest removing it and installing it the proper way.
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
@Vadorequest If everything is in ~/.nvm
then it is installed with the official installation script.
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
Note tho that those lines are safe noops if you’ve deleted the dir.
@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.
hmm, I’m not sure why a root env var would persist in a non-root session, but fair enough.
@dorkmania You don’t have to reboot, just log in again (as non-root user, of course).
@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)
@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.
@FranklinYu Makes sense.
rm -rf ~/.nvm
rm -rf ~/.npm
rm -rf ~/.bower
works like fine-wine!
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.
Works like a charm!
It is very inconvenient way. First we need to remove directories and then we need to bother with cleaning up configs manually Why not to make it a special command?
@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.
@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
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.
work for me in macos rm -rf ~/.nvm brew cleanup --prune-prefix
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...
@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.
@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🙂
I wrote a script for the nuclear option of blowing everything away. Yes it's destructive!
Also added option to install volta to manage tools.
https://docs.volta.sh/guide/#why-volta
If you're in an agreeable mood when you run the script you'll end up with node, npm, and nvm gone with volta installed instead.
I want to uninstall nvm completely. Is there documentation on how to do this?