[FIXED] nvm install node fails to install on macOS Big Sur M1 Chip

Issue

I’m trying to install the latest version of node using nvm. I’ve just got the newly released SIlicon Macbook Pro with the M1 chip (not sure if that is related). I’ve installed xcode on the app store and the xcode tools on the command line. The main error i’m getting is:

clang: error: no such file or directory: 'CXX=c++'

Solution

If you have installed nvm using homebrew and are trying to install the node using command nvm install <some_version>, you will face errors on apple silicon machines (ARM) for versions lower than 15. Node versions older than 15 do not work on apple silicon machines (ARM) because ARM architecture is not supported.
For anything under v15, you will need to install node using Rosetta 2.

  1. How to open terminal in Rosetta2 mode: Go to Application -> Right click on terminal app -> Get Info -> Select "Open using Rosetta" -> Restart Terminal
  2. In Terminal, write -> arch -x86_64 zsh

Now you will able to install any version of node (even multiple versions)

Answered By – adityaatri

Answer Checked By – Terry (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published