当前位置: 首页 > news >正文

【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

http://www.mrgr.cn/news/10766.html

相关文章:

  • 容器的ip地址不稳定问题、联合文件系统、核对时间、制作基础镜像
  • 突破编程:深入理解C++中的组合模式
  • docker容器run命令设置
  • Linux中断管理
  • STC89C52 定时器浅谈
  • 树数据结构(Tree Data Structures)的全面指南:深度解析、算法实战与应用案例
  • 深度优先搜索模板
  • 【Material-UI】Radio Group中的 Label Placement 属性详解
  • 【Solidity】支付
  • SparkSQL数值模式详解
  • 【功能实现】axios实现动态数据
  • Part3-DOM学习笔记-操作元素
  • FFmpeg源码:ffurl_seek2、ffurl_seek、avio_size函数分析
  • 微服务通信
  • Godot《躲避小兵》实战之为游戏添加音效
  • Java:Date类
  • 经典数据结构 | 原理与应用场景汇总
  • redis--分布式锁
  • 零日漏洞:隐匿的威胁与深度剖析
  • Elasticsearch对象映射