Wednesday, July 14, 2021

nvm install node fails to install on macOS Big Sur M1 Chip

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++'


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


How to open terminal in Rosetta2 mode -> got to Application -> right click on terminal app -> get Info -> Select "Open using Rosetta" -> Restart Terminal

In Terminal, write -> arch -x86_64 zsh Now you will able to install any version of node (even multiple versions)


references:

http://5.9.10.113/67254339/nvm-install-node-fails-to-install-on-macos-big-sur-m1-chip


No comments:

Post a Comment