本文主要是介绍【Node】m1 mac 使用 nvm 安装 node v14 报错,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
author: jayzhen
date: 20240826
报错内容
- nvm 0.39.3
- macbook m1pro os14.6.1
v8_compiler/deps/v8/src/compiler/backend/instruction-selector.o.d.raw -c
In file included from ../deps/v8/src/compiler/backend/frame-elider.cc:5:
In file included from ../deps/v8/src/compiler/backend/frame-elider.h:8:
In file included from ../deps/v8/src/compiler/backend/instruction.h:14:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]static constexpr T kMax = static_cast<T>(kNumValues - 1);^
In file included from ../deps/v8/src/compiler/backend/instruction-scheduler.cc:5:
In file included from ../deps/v8/src/compiler/backend/instruction-scheduler.h:9:
In file included from ../deps/v8/src/compiler/backend/instruction.h:14:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]static constexpr T kMax = static_cast<T>(kNumValues - 1);^
In file included from ../deps/v8/src/compiler/backend/code-generator.cc:5:
In file included from ../deps/v8/src/compiler/backend/code-generator.h:11:
In file included from ../deps/v8/src/codegen/macro-assembler.h:8:
In file included from ../deps/v8/src/codegen/turbo-assembler.h:12:
In file included from ../deps/v8/src/codegen/assembler-arch.h:8:
In file included from ../deps/v8/src/codegen/assembler.h:45:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]static constexpr T kMax = static_cast<T>(kNumValues - 1);
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
解决方案
Node v14 不支持 ARM64,因此nvm无法找到支持的二进制文件,并尝试构建源代码(也失败了)
为了在具有 arm64 的 Mac 上安装 v14,您需要使用 Rosseta。
您可以Rosseta使用以下命令进行安装:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
nvm在更改以下内容后将允许运行安装arch (也可以只执行这个,不用上面内容):
arch -x86_64 zsh
nvm install 14.21.3
参考
- https://github.com/nodejs/node/issues/52306
- https://github.com/web3/web3.js/issues/3408
这篇关于【Node】m1 mac 使用 nvm 安装 node v14 报错的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!