Home > other >  how to upgrade node to 16 on ARM mac with macos 12.4
how to upgrade node to 16 on ARM mac with macos 12.4

Time:06-02

I have node v15.10.0 installed. I dont know how it was installed. I found this article on how to update node. For mac it recommends using the official binary installer, which I did. It says the new version should overwrite the old version. After installation, if I open a new terminal and do node --version, it stills says 15.10.0

The question is, how do I fully delete the old version, and install the new?

My path looks like this: /Users/xx/.nvm/versions/node/v15.10.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/opt/apache-maven/bin

I presume I could hack the path using a shell script, but is there a better way? Why did the installer not do this for me?

If we have to hack the path (for each user), which is the correct file? I see there is a .bashrc and a .zprofile in my home dir. They are not linked, but they have identical content, which is bazare, and they do not contain code to add /Users/xx/.nvm/versions/node/v15.10.0/bin to the path, so this must be set outside of either file?

I cant see 15 path in /etc/paths either.

I have no idea what shell you get in Mac now a days, but if I do ps -ef I see it mentions both bash and zsh.

Presumably I need to change the path on both ?

CodePudding user response:

Thanks to @AKX this was the solution:

nvm uninstall 15.10.0

Now I see v16.

CodePudding user response:

if you have nvm installed, the best way is :

nvm install 16

To switch between installed node version:

nvm use 16

To set default node version:

nvm alias default 16
  • Related