How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu).

27,016

Solution 1

One-liner to install all needed dependencies(curl and git are not really needed, but are very useful and also needed if you install via nvm).

sudo apt-get install build-essential libssl-dev curl git-core

Last two dependencies are not always needed, but installing them is really usefull anyway and you probably need it later anyway.

To only install cxx compiler

sudo apt-get install build-essential

If openssl is missing

sudo apt-get install libssl-dev

Solution 2

If like me, you are attempting to install this on an AWS instance running Amazon Linux AMI (which looks to be a cut down version CentOS):

Install base tools:

yum groupinstall "Development Tools"

Now install openssl-devel:

yum install openssl-devel

Node should compile fine now.

Solution 3

If you're attempting this on Win7 like me, running:

ash.exe
$ /bin/rebaseall

...did the trick.

Good luck!

Solution 4

If you find yourself getting this error on Mac OSX, you need to install XCode.

https://developer.apple.com/

Solution 5

I needed to run yum install gcc-c++ on Cent OS.

Share:
27,016
Alfred
Author by

Alfred

Updated on December 29, 2020

Comments

  • Alfred
    Alfred over 3 years

    How can I compile/install node.js on Ubuntu? It failed with an error about cxx compiler.

  • Alfred
    Alfred over 13 years
    I also found this very good tutorial explaining how to install node.js on ubuntu => codediesel.com/linux/installing-node-js-on-ubuntu-10-04
  • Alfred
    Alfred over 13 years
    I think you should make this a separate topic if it does not exist. Then when users google for compiling node.js for windows they will find your topic.
  • Alfred
    Alfred almost 13 years
    I also heard this of a friend of mine using macosx
  • Jay Sidri
    Jay Sidri almost 13 years
    Should be worth noting that Nicholas is compiling node in Windows using cygwin. ash.exe and rebaseall.exe are utilities that ship with cygwin.
  • tentonipete
    tentonipete almost 13 years
    this should be on your installation DVD. at least it was on my copy of snow leopard.
  • Mike Grace
    Mike Grace over 12 years
    Thank you! This is exactly what I needed. Saved me tons of time.
  • Dominic K
    Dominic K over 12 years
    Running ash.exe in bash gave me weird output. I opened a normal cmd instead, and ran cd C:/cygwin/bin,, then dash.exe (A better ash.exe supposedly, but either works). Then used ./rebaseall
  • quantumpotato
    quantumpotato about 12 years
    I have Xcode installed from the app store and still get this error.
  • tosh
    tosh almost 12 years
    @quantumpotato same here with mountain lion :(
  • timoxley
    timoxley almost 12 years
    Try sudo. Had same issue but managed to get it to build with sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer then using sudo to configure/install.