centos升级node版本

查看node版本

node -v

node版本的管理模板n

npm i -g n --force

升级node

#稳定版
n stable
#最新版
n latest
#指定版本
n 版本号  #如 n 10.0.0

常见问题

node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by node)

解决:
1.升级libstdc++.so.6

#下载libstdc++.so.6.0.26
mv libstdc++.so.6.0.26 /usr/lib64/
cd /usr/lib64/
rm libstdc++.so.6
ln /usr/lib64/libstdc++.so.6.0.26 /usr/lib64/libstdc++.so.6

2.升级glibc

cd /opt
wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.17.tar.gz
tar -zxvf glibc-2.17.tar.gz
mkdir /opt/glibc-2.17/build
cd /opt/glibc-2.17/build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make && make install

安装完成,检查:

strings /lib64/libc.so.6|grep ^GLIBC

glibc 所有版本下载地址 : http://ftp.gnu.org/pub/gnu/glibc/

参考资料

参考1: https://blog.csdn.net/guzhao593/article/details/81712016
参考2:https://blog.csdn.net/DEL5202587/article/details/83069825
参考3:https://www.cnblogs.com/small-wei/p/10895706.html

你可能感兴趣的:(centos,node.js,npm,gcc)