我的目标是 * 安装节点版本8*,这样我就可以在项目上运行 Gulp。 我正在处理一个被另一个开发人员忽略并传给我的旧项目。我被告知可以通过安装Node Version 8并在我的package.json文件中声明节点版本来使用Gulp。 但是,每当我尝试运行nvm install 8时,都会收到错误error: "unsupported ARM architecture" 我的系统是 *MacOS Big Sur M1芯片 * 我不知道我该怎么办。请帮帮我!
//# Check what version you're running:
$ node --version
v14.15.4
//# Check architecture of the `node` binary:
$ node -p process.arch
arm64
//# This confirms that the arch is for the M1 chip, which is causing the problems.
//# So we need to uninstall it.
//# We can't uninstall the version we are currently using, so switch to another version:
$ nvm install v12.20.1
//# Now uninstall the version we want to replace:
$ nvm uninstall v14.15.4
//# Launch a new zsh process under the 64-bit X86 architecture:
$ arch -x86_64 zsh
//# Install node using nvm. This should download the precompiled x64 binary:
$ nvm install v14.15.4
//# Now check that the architecture is correct:
$ node -p process.arch
x64
//# It is now safe to return to the arm64 zsh process:
$ exit
//# We're back to a native shell:
$ arch
arm64
//# And the new version is now available to use:
$ nvm use v14.15.4
Now using node v14.15.4 (npm v6.14.10)
2条答案
按热度按时间fykwrbwg1#
解决方案
解决方案是将我的shell架构从arm 64更改为x86。
配备M1芯片的Mac
您可能会遇到的一些问题:
1.使用NVM来安装例如v14.15.4:
$ NODE_OPTIONS="--max-old-space-size=4096" ./node_modules/.bin/your_node_package
1.当使用nvm安装某些版本时,编译失败
这个问题的一个解决方案是将shell的体系结构从arm 64更改为x86。
让我们假设:
mefy6pfw2#
使用Rosetta打开(选择此项目)
nvm install 8