Skip to content

Instantly share code, notes, and snippets.

@bradwestfall
Last active January 23, 2022 17:33
Show Gist options
  • Save bradwestfall/2ca354323e30924c9099 to your computer and use it in GitHub Desktop.
Save bradwestfall/2ca354323e30924c9099 to your computer and use it in GitHub Desktop.
sudo npm uninstall npm -g
brew uninstall node

Then

sudo rm -rf /usr/local/lib/dtrace/node.d /usr/local/lib/node_modules /usr/local/bin/npm /usr/local/bin/nodemon /usr/local/bin/node /usr/local/include/node ~/.npm* ~/.node* /usr/local/share/man/*/node* /usr/local/share/man/*/npm*

Which removes the following

  • /usr/local/lib/dtrace/node.d
  • /usr/local/lib/node_modules
  • /usr/local/bin/npm
  • /usr/local/bin/nodemon
  • /usr/local/bin/node
  • /usr/local/include/node
  • ~/.npm*
  • ~/.node*
  • /usr/local/share/man/*/node*
  • /usr/local/share/man/*/npm*
@derplak
Copy link

derplak commented Jun 5, 2020

Hi everyone here, I´ve had this same problem, searched a lot in Stack Overflow and Node.JS docs to fix this without make it, but today (while researched a bit more) founded this, is a "non code" solution but worked amazingly well and was much safer than running commands with exotic flags:

Deleting Node.JS from Mac computer

Hope this works to you too, that guy saved my day for sure!
(I´m on High Sierra)

@riderrocks
Copy link

Hi everyone here, I´ve had this same problem, searched a lot in Stack Overflow and Node.JS docs to fix this without make it, but today (while researched a bit more) founded this, is a "non code" solution but worked amazingly well and was much safer than running commands with exotic flags:

Deleting Node.JS from Mac computer

Hope this works to you too, that guy saved my day for sure!
(I´m on High Sierra)

Thanks for sharing. It worked!

@derplak
Copy link

derplak commented Apr 26, 2021

Hi everyone here, I´ve had this same problem, searched a lot in Stack Overflow and Node.JS docs to fix this without make it, but today (while researched a bit more) founded this, is a "non code" solution but worked amazingly well and was much safer than running commands with exotic flags:
Deleting Node.JS from Mac computer
Hope this works to you too, that guy saved my day for sure!
(I´m on High Sierra)

Thanks for sharing. It worked!

Glad to read that brother, I´m planning to realease a front/back end public wiki with troubleshooting, if you are interested I´ll be posting the link in my GitHub profile 😉

@lerocha
Copy link

lerocha commented Jun 29, 2021

Thanks for this script! It worked for me to uninstall node 14.17.1 from my mac! I only needed to exclude /usr/local/bin/nodemon from the list since this directory doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment