开发的app需要使用旧版本的node.js, 比如node v10, v12

但是M1电脑的芯片是apple的, 所以兼容不了旧版本的

通过搜索知道了,可以通过下面的方法成功安装

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.

1. How to open Terminal in Rosetta2 mode -> got 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)

参考链接: https://stackoverflow.com/questions/67254339/nvm-install-node-fails-to-install-on-macos-big-sur-m1-chip

windows下安装node.js(M1电脑怎么安装旧版本的node.js)(1)

,