NPM Command Not Found After Installing Node

Ok this is what worked for me:

$ brew update
$ brew uninstall node
$ brew install node
$ sudo brew postinstall node #This what the important step

In case this never got solved, this is what worked for me:

  1. brew uninstall node
  2. brew install node
  3. brew doctor and see what needs to be pruned. My problem was there was a non-brew place where I had changed my install location for npm packages because I was trying to get an npm package to install for me. That was a mistake (having forgotten I initially installed node and npm through brew but now brew could no longer reach the npm install directory nor could it change or delete it). So brew prune didn't work even though the symlinks were supposedly deleted but it reminded me that I had changed the npm install location. And that brings us to:

  4. Delete those directories

  5. brew postinstall node

Hope it helps.


I came across to this thread with the same problem but finally below is what worked for me which is without sudo

$ brew update
$ brew uninstall node
$ brew install node
$ chown -R YourUserName /usr/local/lib/node_modules/
$ brew postinstall node #This what the important step

Not an answer, but maybe a solution...

Uninstall Node via brew: brew uninstall node

Then download Node from https://nodejs.org/en/download/ and install.

npm should then "just work".