ubuntu安装nodejs出现./config.gypi错误

时间:2020-12-05 18:08:46

报错的内容如下:

xxx@xxx [/usr/local/src/node-v0.8.3]# ./configure
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [],
'libraries': []},
'variables': { 'host_arch': 'x64',
'node_install_npm': 'true',
'node_install_waf': 'true',
'node_prefix': '',
'node_shared_openssl': 'false',
'node_shared_v8': 'false',
'node_shared_zlib': 'false',
'node_use_dtrace': 'false',
'node_use_etw': 'false',
'node_use_openssl': 'true',
'target_arch': 'x64',
'v8_no_strict_aliasing': ,
'v8_use_snapshot': 'true'}}
creating ./config.gypi
Traceback (most recent call last):
File "./configure", line , in <module>
pprint.pformat(output, indent=) + "\n")
File "./configure", line , in write
f = open(filename, 'w+')
IOError: [Errno ] Permission denied: './config.gypi'

解决方法:

在ubuntu中,先安装git

~ sudo apt-get install git

然后,从github下载nodejs源代码

~ git clone git://github.com/joyent/node.git
Cloning into 'node'...
remote: Counting objects: 100200, done.
remote: Compressing objects: 100% (28074/28074), done.
remote: Total 100200 (delta 78807), reused 90936 (delta 70473)
Receiving objects: 100% (100200/100200), 61.81 MiB | 698 KiB/s, done.
Resolving deltas: 100% (78807/78807), done.

进入node目录

~ cd node
~ pwd
/home/conan/workspace/nodejs/node

  

切换最新的release的版本v0.11.2-release

~ git checkout v0.11.2-release
Branch v0.11.2-release set up to track remote branch v0.11.2-release from origin.
Switched to a new branch 'v0.11.2-release'

  

后面的步骤就是一样的了,进行安装

./configure
make
sudo make install

  

参考资料:http://blog.fens.me/nodejs-enviroment/#gsc.tab=0