Node using the wrong version after Brew Install

I am using a Macbook with the latest macOS (10.12.3) and I installed Homebrew by running:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

      

After that I installed node:

brew install node

      

And tried to update it:

> brew upgrade node
> Error: node 7.8.0 already installed

      

I got an error saying that version 7.8.0 is already installed, which is expected since I just installed the most recent version.

Problem: on the terminal, I ran:

> node --version
> v4.4.5

      

and got an old version that apparently was already installed. Also, when I install a new package via npm

, I get a warning that the package requires a newer version of node.

Question: It seems I have both versions of node installed on my mac, how can I use the latest one? And how can I remove all old versions of node?

Many thanks for your help!

+3


source to share


1 answer


My problem was resolved after @ theWanderer4865 suggestions in the comments.

Firstly, I uninstalled the node version I installed via brew: in the completed terminal:

> brew cleanup
> brew uninstall node

      

Secondly, I uninstalled all other versions of node that I installed by running:



> rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,n‌​ode*,man1/node*}

      

Third, install node again using nvm

:

> nvm install node

      

+3


source







All Articles