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

- 60,935
- 33
- 147
- 186
-
Because you didn't actually ask a question, it seems. – Jim Rubenstein Aug 31 '12 at 12:50
-
Okay I updated post to be more like a question I guess – Alfred Aug 31 '12 at 19:36
7 Answers
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
-
4I also found this very good tutorial explaining how to install node.js on ubuntu => http://www.codediesel.com/linux/installing-node-js-on-ubuntu-10-04/ – Alfred Dec 05 '10 at 02:26
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.

- 6,271
- 3
- 43
- 62
If you're attempting this on Win7 like me, running:
ash.exe
$ /bin/rebaseall
...did the trick.
Good luck!

- 30,271
- 4
- 90
- 101
-
1I 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 Dec 25 '10 at 20:53
-
1Should be worth noting that Nicholas is compiling node in Windows using cygwin. `ash.exe` and `rebaseall.exe` are utilities that ship with cygwin. – Jay Sidri Jun 23 '11 at 06:17
-
1Running `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` – Dominic K Aug 28 '11 at 03:15
If you find yourself getting this error on Mac OSX, you need to install XCode.

- 96
- 1
- 4
-
-
this should be on your installation DVD. at least it was on my copy of snow leopard. – tentonipete Jul 08 '11 at 21:33
-
2I have Xcode installed from the app store and still get this error. – quantumpotato Apr 22 '12 at 20:03
-
-
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. – timoxley Aug 01 '12 at 17:19
There is a package for it on launchpad.
https://launchpad.net/~chris-lea/+archive/node.js/

- 497
- 4
- 19
For Node.js v6:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
For Node.js v7:
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
Optional: install build tools To compile and install native addons from npm you may also need to install build tools:
sudo apt-get install -y build-essential
After to get latest NPM packages, if you need:
npn update -g

- 2,059
- 1
- 20
- 27