linux安装node报错问题

问题:linux安装node 18版本及以上都报错:

[root@master1 ~]# cd node-v20.10.0-linux-x64
[root@master1 node-v20.10.0-linux-x64]# ls
bin  CHANGELOG.md  include  lib  LICENSE  README.md  share
[root@master1 node-v20.10.0-linux-x64]# cd bin/
[root@master1 bin]# ls
corepack  node  npm  npx
[root@master1 bin]# ./node -v 
./node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./node)
./node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by ./node)
./node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by ./node)

检查glibc的情况: 

strings /usr/lib64/libstdc++.so.6 | grep GLIBC

安装glibc-2.28

[root@master1 local]# wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
[root@master1 local]# tar -xzvf glibc-2.28.tar.gz
[root@master1 local]# cd glibc-2.28
[root@master1 glibc-2.28]# mkdir build  && cd build
[root@master1 build]# ../configure --prefix=/usr/local/glibc-2.28 --disable-profile --enable-add-ons --with-headers=/usr/local/glibc-2.28 --with-binutils=/usr/local/glibc-2.28/bin

报错:

configure: error: 
*** These critical programs are missing or too old: make compiler
*** Check the INSTALL file for required versions.

需要升级gcc与make

[root@master1 local]# wget https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.gz
[root@master1 local]# tar -xzvf gcc-8.4.0.tar.gz
[root@master1 local]# cd gcc-8.4.0
[root@master1 local]# mkdir build && cd build
[root@master1 build]# ../configure --prefix=/usr/local/gcc-8.4.0/build --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++,fortran --with-gmp=/usr/local/gcc-8.4.0/build --with-mpfr=/usr/local/gcc-8.4.0/build --with-mpc=/usr/local/gcc-8.4.0/build
[root@master1 build]# make -j4
[root@master1 build]# make install
...
时间很长
...
[root@master1 build]# mv /usr/bin/gcc /usr/bin/gcc.2024.3.26
[root@master1 build]# ln -s /usr/local/gcc-8.4.0/build/bin/gcc /usr/bin/gcc
[root@master1 build]# mv /usr/bin/g++ /usr/bin/g++.2024.3.26
[root@master1 build]# ln -s /usr/local/gcc-8.4.0/build/bin/g++ /usr/bin/g++
[root@master1 local]# wget http://ftp.gnu.org/gnu/make/make-4.3.tar.gz
[root@master1 local]# tar -zxvf make-4.3.tar.gz
[root@master1 local]# cd make-4.3
[root@master1 make-4.3]# ./configure  --prefix=/usr/local/make-4.3
[root@master1 make-4.3]# make && make install
[root@master1 make-4.3]# mv /usr/bin/make make.2024.3.26
[root@master1 make-4.3]# ln -sv /usr/local/make-4.3/bin/make /usr/bin/make

然后返回继续升级glibc-2.28

[root@master1 build]# ../configure --prefix=/usr/local/glibc-2.28 --disable-profile --enable-add-ons --with-headers=/usr/local/glibc-2.28 --with-binutils=/usr/local/glibc-2.28/bin

报错:系统内核版本太低了

checking whether the linker provides working __ehdr_start... yes
checking for __builtin_trap with no external dependencies... yes
checking whether the C++ compiler supports thread_local... no
running configure fragment for sysdeps/unix/sysv/linux/x86_64/64
running configure fragment for sysdeps/unix/sysv/linux/x86_64
running configure fragment for sysdeps/unix/sysv/linux
checking installed Linux kernel header files... missing or too old!
configure: error: GNU libc requires kernel header files from
Linux 3.2.0 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 3.2.0 or later.  This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files.  To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.

 升级系统内核

请参考 <<<

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小邋遢2.0

你的鼓励将是我创作的最大动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值