日期:2014-05-16  浏览次数:20495 次

Nodejs v0.8.12安装
版本:v0.8.12
系统:centos5.5


wget http://nodejs.org/dist/v0.8.12/node-v0.8.12.tar.gz
tar -zxvf node-v0.8.12.tar.gz
cd node-v0.8.12
./configuer
make && make install

出错:

configure. File "./configure", line 266 o['default_configuration'] = 'Debug' if options.debug else 'Release'
^
SyntaxError: invalid syntax


python版本过低导致,升级安装

wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2
tar -zxvf Python-2.7.2.tar.bz2
cd Python-2.7.2
./configure
make && make install

#升级默认版本
mv python /usr/bin/python24
ln -s /usr/local/bin/python2.7 /usr/bin/python 




回到node-v0.8.12目录,重新安装
./configuer
make && make install


继续出错,如下:
Traceback (most recent call last):
  File "../../tools/js2c.py", line 36, in <module>
    import bz2
ImportError: No module named bz2
make[1]: *** [/home/softs/node-v0.8.12/out/Release/obj/gen/libraries.cc] Error 1
make[1]: Leaving directory `/home/softs/node-v0.8.12/out'
make: *** [node] Error 2


这个错误是由于python中没有装bz2的库导致的

yum install -y bzip2* 

cd Python-2.7.2/Modules/zlib  
./configure 
make && make install 

cd Python-2.7.2/  
python2.7 setup.py install 



再次安装nodejs,这次正常了。