Node using wrong version after Brew Install
I had a similar problem, and the Salome answer fixed it, but, when I opened a new shell, it reverted to an older version of node. If I typed node list
I found I still had a number of versions, despite following Salome's instructions to remove all the old versions.
I could fix it by typing nvm use v7.8.0
, but that does not work for a new shell. I was able to fix it permanently following this SO answer
nvm alias default 7.8.0
My problem was solved following @theWanderer4865 suggestions in the comments.
First, I uninstalled the node version I had installed through brew: in the terminal I executed:
> brew cleanup
> brew uninstall node
Second, I removed all other node versions I had installed by running:
> rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
Third, install node again using nvm
:
> nvm install node
- brew install node
- brew upgrade node
- node -v
- sudo n latest
- node -v
1st step will install node using homebrew then you need to upgrade node using homebrew as in step 2 mentioned above , after then when you check node version you'll see latest node already installed but still works on older version, then finally when you run step 4 cmd it will install the latest node and if you check now this will show you the latest node version and ya you are ready to go now . This worked for me