LiviuIosim
LiviuIosim

Reputation: 21

How to run a NodeJS version for Intel on mac M1?

At first I had problems with running Node natively on my M1 machine. After installing NodeJS v15 through NVM I was able to compile my application for arm64(apple silicon) with no problem.

How could I switch back to installing NodeJs for Intel, so I can build my projects for both M1 and Intel on the same machine?

I tried reverting to a NodeJS version before v15, but that did not work when compiling.

Upvotes: 1

Views: 11138

Answers (1)

Raz Luvaton
Raz Luvaton

Reputation: 3770

Try:

  • Before installing the older node version with nvm we need to change zsh to work in x64 arch.
arch -x86_64 zsh
  • Checking node -p process.arch then output x64 instead of arm64. means it able to run with rosetta 2.
  • After installing it, change zsh back to arm64
arch -arm64 zsh
  • Rerun the lerna job and it's working normally. Each cpu monitored work averaging 40%, the temperature is normal (below 50 C), all job is marked as intel and the job done around 20 minutes (as expected).

From Notes on NodeJS in Apple M1 via NVM

Upvotes: 11

Related Questions