How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu).
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.
Solution 5
I needed to run yum install gcc-c++
on Cent OS.
Alfred
Updated on December 29, 2020Comments
-
Alfred over 3 years
How can I compile/install node.js on Ubuntu? It failed with an error about
cxx compiler
. -
Alfred over 13 yearsI 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 over 13 yearsI 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 almost 13 yearsI also heard this of a friend of mine using macosx
-
Jay Sidri almost 13 yearsShould be worth noting that Nicholas is compiling node in Windows using cygwin.
ash.exe
andrebaseall.exe
are utilities that ship with cygwin. -
tentonipete almost 13 yearsthis should be on your installation DVD. at least it was on my copy of snow leopard.
-
Mike Grace over 12 yearsThank you! This is exactly what I needed. Saved me tons of time.
-
Dominic K over 12 yearsRunning
ash.exe
in bash gave me weird output. I opened a normalcmd
instead, and rancd C:/cygwin/bin,
, thendash.exe
(A betterash.exe
supposedly, but either works). Then used./rebaseall
-
quantumpotato about 12 yearsI have Xcode installed from the app store and still get this error.
-
tosh almost 12 years@quantumpotato same here with mountain lion :(
-
timoxley almost 12 yearsTry 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.