jenkins slave節點增加nodejs 報錯處理

下載nodejs包並並運行報錯

export PATH=/opt/node-v20.9.0-linux-x64/bin/:$PATH 

[12:01:51 root@dev-test-lingowhale-app opt]#node -v
node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' 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.20' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)

解決

  • 原因
查看系統內安裝的glibc版本
然後再根據分析可得知 新版的node v18開始 都需要GLIBC_2.27支持,可是目前系統內卻沒有那麼高的版本
  • 更新glibc
根據提示 安裝所需要的glibc-2.28

wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar xf glibc-2.28.tar.gz 
cd glibc-2.28/ && mkdir build  && cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

可能出現的錯誤
上步更新glibc 可能會發生錯誤。
如果沒有錯誤 下邊這一步 不用看。

make問題

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

# 解決辦法:升級gcc與make
# 升級GCC(默認爲4 升級爲8)
yum install -y centos-release-scl
yum install -y devtoolset-8-gcc*
mv /usr/bin/gcc /usr/bin/gcc-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++

# 升級 make(默認爲3 升級爲4)
wget http://ftp.gnu.org/gnu/make/make-4.3.tar.gz
tar -xzvf make-4.3.tar.gz && cd make-4.3/
./configure  --prefix=/usr/local/make
make && make install
cd /usr/bin/ && mv make make.bak
ln -sv /usr/local/make/bin/make /usr/bin/make

# 這時 所有的問題 都已經解決完畢 再重新執行上一步 更新glibc即可
cd /root/glibc-2.28/build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

# 我的依舊報錯:bison太老舊
configure: error: 
*** These critical programs are missing or too old: bison
*** Check the INSTALL file for required versions.

#看看我的bison版本多少
[root@172 ~]# bison -v
-bash: bison: 未找到命令

#bison問題,嗨,沒裝啊。裝一下唄
yum install -y bison

# 這時 所有的問題 真的真的都已經解決完畢 再重新執行上一步 更新glibc即可
cd /root/glibc-2.28/build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

make && make install

驗證下
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章