A solution to g++ command not found an error while installing nodejs packages.
I was installing Browsertime on CentOS 7 and encountered this error.
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=11.15.0 runtime=node arch=x64 libc= platform=linux)
make: Entering directory `/usr/lib/node_modules/browsertime/node_modules/sharp/build'
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
make: g++: Command not found
make: *** [Release/obj.target/sharp/src/common.o] Error 127
make: Leaving directory `/usr/lib/node_modules/browsertime/node_modules/sharp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
Well, this could happen with any package which uses g++
library. To fix this error, all you got to do is install development tools with yum
as below command.
yum groupinstall 'Development Tools'
Try to install what you were installing. It worked for me, and I hope for you too.