Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
the best way (I've found) to completely uninstall node + npm is to do the following:
go to /usr/local/lib and delete any node and node_modules
go to /usr/local/include and delete any node and node_modules directory
if you installed with brew install node, then run brew uninstall node in your terminal
check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
go to /usr/local/bin and delete any node executable
You may need to do the additional instructions as well:
sudo rm /usr/local/bin/npm
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
sudo rm -rf ~/.npm
sudo rm -rf ~/.node-gyp
sudo rm /opt/local/bin/node
sudo rm /opt/local/include/node
sudo rm
–rf /usr/local/bin/node
sudo rm -rf /opt/local/lib/node_modules
sudo
rm -rf /Users/[homedir]/.npm
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/share/man/man1/node.1
sudo rm -rf /usr/local/lib/dtrace/node.d
Then install nodeJS via Node Version Manager
1. Install NVM by running the following in Terminal using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
2.
Update "$HOME/.bash_profile" to include the following lines:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
nvm use v0.12.4
3.
Install Node.js by running the following in Terminal:
nvm install v0.10.31
nvm install v0.12.0
nvm install v0.12.4
nvm alias default 0.12.4
nvm use v0.12.4
4.
source "$HOME/.bash_profile"
@priyankamalviya

This comment has been minimized.

Copy link

priyankamalviya commented Jan 22, 2018

I get a bunch of EPERM errors on sudo rm -rf ~/.node-gyp
sudo rm /opt/local/bin/node.. :(

@great2gether

This comment has been minimized.

Copy link

great2gether commented Feb 9, 2018

Better with homebrew from the terminal:
$ brew uninstall node

@jtiscione

This comment has been minimized.

Copy link

jtiscione commented Mar 2, 2018

Unfortunately homebrew has a habit of corrupting Node installations on OSX.

@danfoy

This comment has been minimized.

Copy link

danfoy commented Aug 31, 2018

I'm 80% confident I've buggered nodejs on my new MacBook by trying to install via homebrew, which is how I found this gist. Lessons learned.

@brandonimitch

This comment has been minimized.

Copy link

brandonimitch commented Feb 14, 2019

Thank you for this, really helpful!

@DavidODonovan

This comment has been minimized.

Copy link

DavidODonovan commented Mar 9, 2019

Thanks!

@vikramvi

This comment has been minimized.

Copy link

vikramvi commented Jul 22, 2019

Even after doing these steps on Mac 10.13.5, still I could see npm and node what may be going wrong ?

@AymanMagdy

This comment has been minimized.

Copy link

AymanMagdy commented Mar 25, 2020

Thanks, man!
That was helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.