Bootstrap

安装node.js环境问题记录

在服务器中离线安装node.js环境,下载官网下载最新的Linux 二进制文件 (x64),node-v16.16.0-linux-x64.tar.xz。

上传至服务器中解压,运行./node -v后,提示:

lib64/libm.so.6: version 'GLIBC_2.28' not found (required by node)

是因为高版本的nodejs需要更高版本的glibc编译环境,目前我的服务器对应的glibc最高只能支持到2.27。

通过命令strings /lib/i386-linux-gnu/libc.so.6 | grep ^GLIBC查看当前系统glibc的版本。

请添加图片描述

贸然更新glibc的版本存在较大的风险,所以建议降低node.js的版本,去兼容低版本glibc

搜索历史版本,查看软件更新日志,通过搜索关键字glibc

软件在V18.0.0修改依赖glibc 2.28,所以我们下载使用Node.js 17.9.1版本,问题解决。

2022-04-19, Version 18.0.0 (Current), @BethGriggs

Node.js 18 is here! Highlights include the update of the V8 JavaScript engine to 10.1, global fetch enabled by default, and a core test runner module.

Initially, Node.js 18 will replace Node.js 17 as our ‘Current’ release line. As per the release schedule, Node.js 18 will be the ‘Current’ release for the next 6 months and then promoted to Long-term Support (LTS) in October 2022. Once promoted to long-term support the release will be designated the codename ‘Hydrogen’. Node.js 18 will be supported until April 2025.

Toolchain and Compiler Upgrades

  • Prebuilt binaries for Linux are now built on Red Hat Enterprise Linux (RHEL) 8 and are compatible with Linux distributions based on glibc 2.28 or later, for example, Debian 10, RHEL 8, Ubuntu 20.04.
  • Prebuilt binaries for macOS now require macOS 10.15 or later.
  • For AIX the minimum supported architecture has been raised from Power 7 to Power 8.
;