在ubunut上源码安装nodejs

2018-11-27  本文已影响14人  AISpider

1.git上获取node.js源码

$ sudo git clone https://github.com/nodejs/node.git
Cloning into 'node'...

2.修改目录执行权限

$ sudo chmod -R 755 node

3.使用 ./configure 创建编译文件

$ cd node
$ sudo ./configure
$ sudo make
$ sudo make install

这里需要注意,如果执行sudo ./configure 报错如下:

WARNING: failed to autodetect C++ compiler version (CXX=g++)
WARNING: failed to autodetect C compiler version (CC=gcc)
ERROR: No acceptable C compiler found!

       Please make sure you have a C compiler installed on your system and/or
       consider adjusting the CC environment variable if you installed
       it in a non-standard prefix.

解决方案:
先确认ubuntu是否安装了python,并且为python2x版本。然后
a>如果你的ubunut下没有yum,先安装yum

$ sudo apt-get install  yum

b>安装gcc 编译工具

$ sudo yum  install  gcc-c++

c>安装 build-essential

sudo apt-get install build-essential 
上一篇 下一篇

猜你喜欢

热点阅读