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

7

73

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

Desperation answered 25/7, 2010 at 13:32 Comment(2)
Because you didn't actually ask a question, it seems.Newel
Okay I updated post to be more like a question I guessDesperation
D
116

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
Desperation answered 25/7, 2010 at 13:32 Comment(1)
I also found this very good tutorial explaining how to install node.js on ubuntu => codediesel.com/linux/installing-node-js-on-ubuntu-10-04Desperation
C
45

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.

Cysticercus answered 14/4, 2011 at 7:14 Comment(1)
Thank you! This is exactly what I needed. Saved me tons of time.Loopy
F
8

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

ash.exe
$ /bin/rebaseall

...did the trick.

Good luck!

Finance answered 25/12, 2010 at 9:35 Comment(3)
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.Desperation
Should be worth noting that Nicholas is compiling node in Windows using cygwin. ash.exe and rebaseall.exe are utilities that ship with cygwin.Cysticercus
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 ./rebaseallYousuf
W
6

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

https://developer.apple.com/

Welford answered 16/6, 2011 at 22:22 Comment(5)
I also heard this of a friend of mine using macosxDesperation
this should be on your installation DVD. at least it was on my copy of snow leopard.Packton
I have Xcode installed from the app store and still get this error.Dumpy
@Dumpy same here with mountain lion :(Indeterminate
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.Dad
G
3

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

Gastrocnemius answered 28/12, 2011 at 23:7 Comment(0)
A
2

There is a package for it on launchpad.
https://launchpad.net/~chris-lea/+archive/node.js/

Acrophobia answered 21/2, 2013 at 22:10 Comment(0)
B
2

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

Partial source here.

Brothers answered 28/12, 2016 at 22:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.