How to compile/install node.js(could not configure

2019-01-10 04:54发布

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

7条回答
女痞
2楼-- · 2019-01-10 05:31

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
查看更多
不美不萌又怎样
3楼-- · 2019-01-10 05:32

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

https://developer.apple.com/

查看更多
放我归山
4楼-- · 2019-01-10 05:33

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.

查看更多
爷、活的狠高调
5楼-- · 2019-01-10 05:35

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

查看更多
在下西门庆
6楼-- · 2019-01-10 05:46

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.

查看更多
放荡不羁爱自由
7楼-- · 2019-01-10 05:48

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

查看更多
登录 后发表回答