[笔记] CentOS7升级gcc g++ make版本,解决node-gyp编译问题

2022-01-28T20:55:19

今天在我的VPS中尝试使用yarn部署时遇到了编译错误,改换为npm install后发现问题是在linux中的better-sqlite3软件包编译失败,具体原因是g++不支持编译器选项-std=c++14

根据查询,自带的g++版本和make版本较低。

在上网查询后,有一些建议使用旧版本python运行,或升级node-gyp等都无效,最终发现升级g++方法有效,无需改换yum。

此方法来自[[Centos7] 升級gcc/gcc-c++ 由5.8版升級到9.3版 @新精讚](http://n.sfs.tw/content/index/14840)

yum install centos-release-scl-rh
yum install devtoolset-9*
scl enable devtoolset-9 bash
source /opt/rh/devtoolset-9/enable
# 修改 /etc/rc.d/rc.local 開機啟動,最下面加入一行
source /opt/rh/devtoolset-9/enable

执行后问题解决。

在此处记录。

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »