React: npm install fails on linux without g++ installed

Created on 25 Apr 2015  路  6Comments  路  Source: facebook/react

I have a fresh installation of Ubuntu 14.04 and installed compiled version of node.js 10.38.

npm install failed on node-gyp rebuild step with error 'make: g++: Command not found'.

apt-get install g++ solves the problem. It make sense put g++ dependency into README.md Prerequisites section.

Most helpful comment

for installing g++ in fedora and other linux os use

sudo yum install /usr/bin/g++
or
sudo dnf install gcc-c++

All 6 comments

That's kind of annoying but yea, we might need to do something like that. Compilers are a dependency for any binary npm module (which one of our dependencies depends on). Even contextify itself doesn't call out the need for g**. When you install node / npm via apt does it not install build-essential as well? It seems like it should since that's a requirement for many modules.

I used the recommended approach for Debian and Ubuntu based distributions . build-essential is not a part of installation. But I see your point, contextify setup on Windows even more complicated.

The installation of build-essential is not 'optional'. It is a prerequisite for npm install otherwise node-gyp will fail.

The instructions for the Debian-based installation should reflect that build-essential is a prerequisite.

for installing g++ in fedora and other linux os use

sudo yum install /usr/bin/g++
or
sudo dnf install gcc-c++

sudo apt-get install build-essential checkinstall fixed it for me (Ubuntu)

sudo yum install /usr/bin/g++ works for CentOS7, too. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brunolemos picture brunolemos  路  285Comments

gaearon picture gaearon  路  126Comments

acdlite picture acdlite  路  83Comments

gaearon picture gaearon  路  227Comments

sebmarkbage picture sebmarkbage  路  136Comments