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