Using NodeJs 14 with Mac Silicon (M1)

Using NodeJs 14 with Mac Silicon (M1)

I have recently received a new MacBook Pro with the Mac Silicon chip. However, I noticed that I am unable to compile NodeJs Version 14 which I have to use due to some of my projects are still on Angular 11 and 12.

Unfortunately, there is no NodeJs 14 that is built for ARM64; Hence it has no support for the new Mac Silicon which is built around ARM64.

Fortunately, there is some workaround to get NodeJs 14 to work with Mac Silicon. Apple provides Rosetta, a translation app that allows applications that are built for Intel Chip (or previous generation Mac) to run under Apple Silicon.

Installing Rosetta

To install Rosetta, you need to:

  1. Open your terminal

  2. Paste and execute /usr/sbin/softwareupdate --install-rosetta --agree-to-license

And that's it!

Installing NodeJs 14

For any Node installation in Mac, I recommend you to use NVM. It allows you to easily swap between Node versions through CLI.

To install NVM:

  1. Open your terminal

  2. Paste and execute curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

  3. Restart your terminal

You can confirm that NVM has been successfully installed by executing nvm command in your terminal.

Now, to get to the real deal on installing NodeJs 14, we will execute everything through terminal.

  1. Open your terminal

  2. Execute arch and confirm that at the moment it is returning arm64

  3. Execute arch -x86_64 zsh

  4. Execute arch and confirm that it is now returning i386

  5. Execute nvm install 14. NVM will install the latest NodeJs 14.

  6. Execute nvm use 14 to switch to NodeJs 14, if you have other NodeJs versions installed.

That's it, folks! You now are able to use NodeJs 14 with your new Mac.