如何在 mac M1 上 运行 Intel 的 NodeJS 版本?

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

起初我在 M1 机器上使用 运行 Node 时遇到了问题。通过 NVM 安装 NodeJS v15 后,我能够毫无问题地为 arm64(apple silicon) 编译我的应用程序。

我如何才能切换回为 Intel 安装 NodeJs,以便我可以在同一台机器上为 M1 和 Intel 构建我的项目?

我尝试恢复到 v15 之前的 NodeJS 版本,但在编译时没有用。

尝试:

  • 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