Rou*_*ndy 3 node.js nvm gulp macos-big-sur
我的目标是安装节点版本 8 ,以便我可以在项目上运行Gulp 。
我正在开发一个旧项目,该项目已被忽视并由另一位开发人员传给了我。我被告知可以通过安装 Node 版本 8 并在 package.json 文件中声明节点版本来使用 Gulp。
但是每当我尝试运行时nvm install 8都会收到错误error: "unsupported ARM architecture"
我的系统是MacOS Big Sur M1 芯片
我不太确定我应该在这里做什么。请帮忙!
Rou*_*ndy 10
解决方案
解决方案是将我的 shell 架构从 arm64 更改为 x86。
配备 M1 芯片的 Mac
2021 年 1 月:Apple 新款 M1 芯片(arm64 架构)没有 15.x 之前版本的预编译 NodeJS 二进制文件。
您可能会遇到的一些问题:
$ NODE_OPTIONS="--max-old-space-size=4096" ./node_modules/.bin/your_node_package此问题的一种解决方案是将 shell 的体系结构从 arm64 更改为 x86。
我们假设:
//# 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)
Run Code Online (Sandbox Code Playgroud)
来源: https: //github.com/nvm-sh/nvm
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           8930 次  |  
        
|   最近记录:  |