Home > front end >  How to install an older version of Node.js with NVM on Mac M1 chipset
How to install an older version of Node.js with NVM on Mac M1 chipset

Time:09-21

I'm struggling with this problem for few days already, how to get version 10.24.1 of Node.js on my MacBook Pro with M1 chipset. It seems to install that version but once I open another terminal or close the existing terminal and open a new one there is the latest version of node (16.8.0)

These are the steps that I had followed:

  • installed brew

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

brew update

  • installed nvm

brew install nvm

  • created a directory for it

mkdir ~/.nvm

  • edited the file

vim ~/.zshrc

  • with this snippet:

export NVM_DIR=~/.nvm

source $(brew --prefix nvm)/nvm.sh

  • load it

source ~/.zshrc

  • installed the wanted version of node

nvm install 10.24.1

  • check it, works fine, it shows this version when node -v

  • use the version:

nvm use 10.24.1

Now, if I search nvm -v it returns 0.38.0, if I search node -v it returns 10.24.1. Everything as it should be. The problem is that this is not saved: if I open a new terminal and type the same commands, for nvm -v it shows the same value but the node version is the latest one, 16.8.0.

Also tried the whole process with running arch -x86_64 zsh before starting but same result.

Any suggestions how to solve this issue?

CodePudding user response:

nvm alias default 10

Change 10 to whatever LTS or other version of node you wish your default to be.

  • Related