[Mac Monterey / Brew] keep showing (using) wrong (old) version of NPM / Node – when trying to reinstall / link – say it’s already done!

Today I have quite funny experience, I tried update node & npm to newest version but i get information it is already installed.

brew unlink node && brew link node
Unlinking /usr/local/Cellar/node/17.4.0… 7 symlinks removed.
Linking /usr/local/Cellar/node/17.4.0… 7 symlinks created.

trying check version show wrong one

npm -v
6.14.15
node -v
v12.22.9

I tried everything, from uninstalling, brew cleanup, link, relink, overwrite – without success.

Solution, edit file (in homedirectory):

.zshrc

In content locate & remove line:

export PATH="/usr/local/opt/node@12/bin:$PATH"

After removing restart computer and confirm correct version of node

npm -v
8.3.1
node -v
v17.4.0

Mission successful

Leave a Reply

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


Warning: Undefined array key 0 in /www/wwwroot/electronicnoobblog.com/wp-content/plugins/wp-google-analytics-scripts/wp-google-analytics-scripts.php on line 602