node.js - nvm:无法安装 v8.6.0,需要安装旧版本的 nodejs 无法安装,(macos bigsur)

标签 node.js macos nvm

我需要安装旧版本的 Node 才能运行产品,但无法使用 nvm install 8.6.0 命令安装版本 8.6.0。

得到两个不同的警告,

  1. 警告:C++ 编译器太旧,需要 g++ 4.9.4 或 clang++ 3.4.2 (CXX=c++)

  2. 警告:在配置阶段发出了警告 xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' 是一个命令行工具实例

Downloading and installing node v8.6.0...
Downloading https://nodejs.org/dist/v8.6.0/node-v8.6.0-darwin-arm64.tar.xz...
##O=- #     #                                                                                                                                                                                              
curl: (22) The requested URL returned error: 404 
Binary download from https://nodejs.org/dist/v8.6.0/node-v8.6.0-darwin-arm64.tar.xz failed, trying source.
grep: /Users/aravind/.nvm/.cache/bin/node-v8.6.0-darwin-arm64/node-v8.6.0-darwin-arm64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 8 CPU core(s)
Running with 7 threads to speed up the build
Clang v3.5+ detected! CC or CXX not specified, will use Clang as C/C++ compiler!
Local cache found: ${NVM_DIR}/.cache/src/node-v8.6.0/node-v8.6.0.tar.xz
Checksums match! Using existing downloaded archive ${NVM_DIR}/.cache/src/node-v8.6.0/node-v8.6.0.tar.xz
$>./configure --prefix=/Users/aravind/.nvm/versions/node/v8.6.0 <
WARNING: C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=c++)
creating ./icu_config.gypi
* Using ICU in deps/icu-small
creating ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'asan': 0,
                 'coverage': 'false',
                 'debug_devtools': 'node',
                 'debug_http2': 'false',
                 'debug_nghttp2': 'false',
                 'force_dynamic_crt': 0,
                 'host_arch': 'arm64',
                 'icu_data_file': 'icudt59l.dat',
                 'icu_data_in': '../../deps/icu-small/source/data/in/icudt59l.dat',
                 'icu_endianness': 'l',
                 'icu_gyp_path': 'tools/icu/icu-generic.gyp',
                 'icu_locales': 'en,root',
                 'icu_path': 'deps/icu-small',
                 'icu_small': 'true',
                 'icu_ver_major': '59',
                 'llvm_version': 0,
                 'node_byteorder': 'little',
                 'node_enable_d8': 'false',
                 'node_enable_v8_vtunejit': 'false',
                 'node_install_npm': 'true',
                 'node_module_version': 57,
                 'node_no_browser_globals': 'false',
                 'node_prefix': '/Users/aravind/.nvm/versions/node/v8.6.0',
                 'node_release_urlbase': '',
                 'node_shared': 'false',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_use_bundled_v8': 'true',
                 'node_use_dtrace': 'true',
                 'node_use_etw': 'false',
                 'node_use_lttng': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_v8_platform': 'true',
                 'node_without_node_options': 'false',
                 'openssl_fips': '',
                 'openssl_no_asm': 0,
                 'shlib_suffix': '57.dylib',
                 'target_arch': 'arm64',
                 'uv_parent_path': '/deps/uv/',
                 'uv_use_dtrace': 'true',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 1,
                 'v8_enable_inspector': 1,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_promise_internal_field_count': 1,
                 'v8_random_seed': 0,
                 'v8_trace_maps': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 0,
                 'xcode_version': 0}}
creating ./config.gypi
creating ./config.mk
WARNING: warnings were emitted in the configure phase
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Traceback (most recent call last):
  File "./configure", line 1452, in <module>
    run_gyp(gyp_args)
  File "./tools/gyp_node.py", line 53, in run_gyp
    rc = gyp.main(args)
  File "./tools/gyp/pylib/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "./tools/gyp/pylib/gyp/__init__.py", line 523, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "./tools/gyp/pylib/gyp/generator/make.py", line 2179, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "./tools/gyp/pylib/gyp/generator/make.py", line 800, in Write
    self.Pchify))
  File "./tools/gyp/pylib/gyp/generator/make.py", line 1195, in WriteSources
    cflags = self.xcode_settings.GetCflags(configname)
  File "./tools/gyp/pylib/gyp/xcode_emulation.py", line 628, in GetCflags
    archs = self.GetActiveArchs(self.configname)
  File "./tools/gyp/pylib/gyp/xcode_emulation.py", line 486, in GetActiveArchs
    xcode_archs_default = GetXcodeArchsDefault()
  File "./tools/gyp/pylib/gyp/xcode_emulation.py", line 118, in GetXcodeArchsDefault
    xcode_version, _ = XcodeVersion()
  File "./tools/gyp/pylib/gyp/xcode_emulation.py", line 1406, in XcodeVersion
    version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'
nvm: install v8.6.0 failed! 

最佳答案

我通过创建一个新终端解决了这个问题,作为一个 rosetta 终端

您可以使用以下过程创建一个 rosetta 终端

Applications -> Utilities -> 右键单击终端并复制 -> 右键单击复制终端 -> Get info -> 选择 open using Rosetta 并将终端重命名为 rosetta-terminal

通过rosetta-terminal安装NVM, 现在安装所需的 Node 版本。

关于node.js - nvm:无法安装 v8.6.0,需要安装旧版本的 nodejs 无法安装,(macos bigsur),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68119534/

相关文章:

node.js - 使用 npm 安装时重命名包

javascript - Nodejs 使用 async/await 进行 Sequelize 事务而不回滚

macos - 将 Metal texture2d_array 传递给 SceneKit 着色器修改器

xcode - 在applescript中写入/读取单个变量

ubuntu - 从 jenkins nvm 执行 SSH 命令时未找到

linux - FUA,冲洗和订购

node.js - 运行使用 Node js 的 CoffeeScript

node.js - 使用 NodeJS 的用户名/密码的 TLS

python - 在 virtualenv 内部安装 M2Crypto,而不在系统中安装 swig

homebrew - Brew安装nvm。 nvm:找不到命令