• 请不要在回答技术问题时复制粘贴 AI 生成的内容
GrahamACER
V2EX  ›  程序员

Linux 下 node-gyp 编译,总是默认使用旧版本 gcc 的问题

  •  
  •   GrahamACER · Aug 8, 2018 · 3733 views
    This topic created in 2840 days ago, the information mentioned may be changed or developed.

    已经在 linux 下下载编译更新了 4.9.1 的 gcc,gcc -v 也显示 4.9.1 版本

    sudo update-alternatives --config gcc 也显示唯一新安装的 4.9.1 的 gcc (新配的)

    目前的问题是,npm install 的话发现 node-gyp 报错,主要内容为

    错误:#error This version of node/NAN/v8 requires a C++11 compiler /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:146: 错误:在指定 -fno-rtti 的情况下不能使用 typeid ...

    依然使用旧版 gcc 4.4.7 默认编译,是不是 npm 有什么位置需要重新配置?

    tempdban
        1
    tempdban  
       Aug 8, 2018 via Android   ❤️ 1
    update-alternatives 不是 Ubuntu 系的命令嘛

    x86_64-redhat-linux 这是啥意思
    GrahamACER
        2
    GrahamACER  
    OP
       Aug 8, 2018
    @tempdban CentOS6 自带这个版本 GCC,安装路径就是 x86_64-redhat-linux
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2812 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 14:26 · PVG 22:26 · LAX 07:26 · JFK 10:26
    ♥ Do have faith in what you're doing.