抱歉,评论被关闭
很久没有玩NODEJS,尝试编译安装
开源项目里面用到NODEJS,很久没有玩NODEJS,尝试编译安装,报编译错误,系统环境:CentOS Linux release 7.8.2003 (Core)
试了一下编译安装报如下错误:
WARNING: C++ compiler (CXX=g++, 4.8.5) too old, need g++ 6.3.0 or clang++ 8.0.0
WARNING: warnings were emitted in the configure phase
# gcc -v
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
看样子版本比较低了。
解决办法重新去下载编译安装
wget http://ftp.gnu.org/gnu/gcc/gcc-7.1.0/gcc-7.1.0.tar.gz
tar zxvf gcc-7.1.0.tar.gz
cd gcc-7.1.0
./contrib/download_prerequisites
mkdir gcc-build-7.1.0
cd gcc-build-7.1.0
../configure –enable-checking=release –enable-languages=c,c++ –disable-multilib
make
make install
gcc -v
安装成功后,继续安装NODEJS
./configure –prefix=/home/node/v14.8.0/
又继续报错如下:
/home/src/node-v14.8.0/out/Release/icupkg: /lib64/libstdc++.so.6: version `CXXABI_1.3.9′ not found (required by /home/src/node-v14.8.0/out/Release/icupkg)
make[1]: *** [/home/src/node-v14.8.0/out/Release/obj/gen/icudt67l.dat] 错误 1
make[1]: 离开目录“/home/src/node-v14.8.0/out”
[root@gitserver node-v14.8.0]
# strings /lib64/libstdc++.so.6|grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1
查询版本低了,查询当初GCC最新生成动态库
find / -name “libstdc++.so.*”
cp /usr/local/lib64/libstdc++.so.6.0.23 /lib64/libstdc++.so.6.0.23
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.23 libstdc++.so.6
继续编译NODEJS
换一种rpm方式安装
curl –silent –location https://rpm.nodesource.com/setup_14.x | bash –
yum -y install nodejs
yarn安装
curl –silent –location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
yum install yarn
文出自 “凹凸曼” 博客,请务必保留此出处 http://www.apoyl.com/?p=2908