Uninstalling npm from macOS

Source: http://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x

Removing npm from mac

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

which is the equivalent of (same as above)…

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

 

or (same as above) broken down…

To completely uninstall node + npm is to do the following:

  1. go to /usr/local/lib and delete any node and node_modules
  2. go to /usr/local/include and delete any node and node_modules directory
  3. if you installed with brew install node, then run brew uninstall node in your terminal
  4. check your Home directory for any local or lib or include folders, and delete any node ornode_modules from there
  5. go to /usr/local/bin and delete any node executable

Then download nvm and follow the instructions to install node. The latest versions of node come with npm, I believe, but you can also reinstall that as well.

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *