Using Brew I have installed Node 8.x due to a version restriction on something i am working on.

I used brew install node@8 in the command line

However i need npm 5.x for a similar reason, which I gather should be possible. However whatever or however Brew installed node/npm I can not override the npm version which is 6.x

Any ideas how I can get this to work?

I have also tried post install to do npm install -g npm@5 which installs a version of npm somewhere, but it is not overriding the npm installed through node@8


It seems that the symlink of the old npm version still exists.

  1. Install the npm version you want
npm install -g npm@X.X.X
  1. Remove the sym link in /usr/local/bin/
rm /usr/local/bin/npm
  1. Recreate the sym link for the correct version of npm
ln -s /usr/bin/npm@X.X.X /usr/local/bin/npm
  • I had actually ended up doing that myself and it worked as expected. So I am going to accept this as the choice answer. The alternative though if you want something less permanent is using nvm – chris Jun 12 '19 at 20:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .