Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install fails on linux without g++ installed #3744

Closed
sejoker opened this issue Apr 25, 2015 · 7 comments
Closed

npm install fails on linux without g++ installed #3744

sejoker opened this issue Apr 25, 2015 · 7 comments

Comments

@sejoker
Copy link

sejoker commented Apr 25, 2015

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.

@zpao
Copy link
Member

zpao commented Apr 27, 2015

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.

@sejoker
Copy link
Author

sejoker commented Apr 27, 2015

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.

Simek added a commit to Simek/react that referenced this issue Sep 8, 2015
Rebuilding 'contextify' (deps from old 'jsdom') on Windows and even on Linux could be problematic (facebook#3744). Bump solves it because current  version of jsdom do not use 'contextify' anymore and 'jest-cli'@0.5.x has dependecy on 'jsdom' without earlier mentioned plugin. 

But there is a restriction that new 'jest-cli' will be working only on iojs >= 2 so accepting that PR is totally up to you and your perferences.
@GeraldScott
Copy link

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.

@yaswanthsvist
Copy link

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

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

zpao added a commit that referenced this issue Jun 17, 2016
pranavgore09 added a commit to pranavgore09/fabric8-ui-builder that referenced this issue Jan 25, 2018
This builder image is being used inside fabric8-planner builds.
Jenkins file https://github.com/fabric8-ui/fabric8-planner/blob/master/Jenkinsfile#L14 --> groovy script https://github.com/fabric8io/fabric8-pipeline-library/blob/master/vars/fabric8UITemplate.groovy#L9 --> https://hub.docker.com/r/fabric8/fabric8-ui-builder/tags/

and fabric8-planner builds are showing an error on console 
```
make: Entering directory `/home/jenkins/workspace/8-ui_fabric8-planner_master-ZPP4IZOIOGZC2EHZQQ2O5PEN76546POVNRCE6JLDNBSQQFFN5RDA@2/node_modules/integer/build'
  CXX(target) Release/obj.target/integer/src/integer.o
make: g++: Command not found
make: *** [Release/obj.target/integer/src/integer.o] Error 127
make: Leaving directory `/home/jenkins/workspace/8-ui_fabric8-planner_master-ZPP4IZOIOGZC2EHZQQ2O5PEN76546POVNRCE6JLDNBSQQFFN5RDA@2/node_modules/integer/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
```
So I feel that we are missing few packages and need to install them. 
Following are packages we need to run the build smoothly
 - groupinstall 'Development Tools'
 - gcc-c++"

Ref:
facebook/react#3744 (comment)
https://unix.stackexchange.com/a/32439

Once merged I hope to see the changes in fabric8-cd whenever I use `container('ui')` in my Jenkins file
@uluhonolulu
Copy link

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

@cnscorpions
Copy link

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

@jokerham
Copy link

What about Mac?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants