Coder Perfect

How to compile and install node.js (I couldn’t get a cxx compiler to work!) (Ubuntu).


On Ubuntu, how can I compile and install node.js? It failed due to a cxx compiler fault.

Asked by Alfred

Solution #1

Install all required dependencies with a single line of code (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

The last two dependencies aren’t usually required, but installing them is always a good idea, and you’ll probably need them later.

Only the cxx compiler should be installed.

sudo apt-get install build-essential

If openssl isn’t installed,

sudo apt-get install libssl-dev

Answered by Alfred

Solution #2

If you’re trying to install this on an AWS instance running Amazon Linux AMI (which appears to be a stripped-down version of CentOS), follow these steps:

Install base tools:

“Development Tools” yum groupinstall

Now install openssl-devel:

yum install openssl-devel

Node should now be able to compile without issue.

Answered by Jay Sidri

Solution #3

If you’re using Win7 like me, you’ll need to run:

$ /bin/rebaseall

…did the trick.

Good luck!

Answered by Nicholas Blumhardt

Solution #4

If you see this problem on Mac OSX, you’ll need to download and install XCode.

Answered by mjamal

Solution #5

On Cent OS, I needed to execute yum install gcc-c++.

Answered by Kelstar

Post is based on