在 centos 中构建 node.js 失败

在 centos 中构建 node.js 失败

我正在尝试在我的 CentOS 服务器上安装 node.js,在我运行“make”命令之前,一切似乎都很完美。当我运行该 make命令时,它会产生以下内容:

make -C out BUILDTYPE=Release V=1
make[1]: Entering directory `/usr/local/src/node-v10.15.3/out'
  g++ -o /usr/local/src/node-v10.15.3/out/Release/obj.host/v8_libbase/deps/v8/src/base/bits.o ../deps/v8/src/base/bits.cc '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=0' '-DV8_TARGET_ARCH_X64' '-DV8_EMBEDDER_STRING="-node.51"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DV8_INTL_SUPPORT' '-DV8_CONCURRENT_MARKING' '-DDISABLE_UNTRUSTED_CODE_MITIGATIONS' -I../deps/v8  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /usr/local/src/node-v10.15.3/out/Release/.deps//usr/local/src/node-v10.15.3/out/Release/obj.host/v8_libbase/deps/v8/src/base/bits.o.d.raw   -c
make[1]: g++: Command not found
make[1]: *** [/usr/local/src/node-v10.15.3/out/Release/obj.host/v8_libbase/deps/v8/src/base/bits.o] Error 127
make[1]: Leaving directory `/usr/local/src/node-v10.15.3/out'
make: *** [node] Error 2

哦,当我运行该./configure命令时,它会产生以下内容:

WARNING: failed to autodetect C++ compiler version (CXX=g++)
creating icu_config.gypi
* Using ICU in deps/icu-small
WARNING: Using floating patch "tools/icu/patches/62/source/i18n/decimfmt.cpp" from "tools/icu"

我尝试用 Google 来解决它,但没有找到任何能帮助我的东西。

答案1

您需要g++通过安装sudo yum install gcc-c++,以防需要任何其他构建工具,只需sudo yum groupinstall "Development Tools"安装必要的构建工具即可

相关内容