node.js简介

安装
我的是centos 安装node.js
1.下载node.js最新稳定版本
2.解压,编译,安装
1 #cd /usr/local/node-V0.4.8
2 #./configure
3 #make
4 #make install
安装依赖python包,如果你的python版本过低,会报下面编译错误
    File "/home/bennybobw/sources/node-v0.2.4/tools/waf-light", line 157, in ?
    import Scripting
    File "/home/bennybobw/sources/node-v0.2.4/tools/wafadmin/Scripting.py", line 9, in ?
    import Utils, Configure, Build, Logs, Options, Environment, Task
    File "/home/bennybobw/sources/node-v0.2.4/tools/wafadmin/Build.py", line 18, in ?
    import Runner, TaskGen, Node, Scripting, Utils, Environment, Task, Logs, Options
    File "/home/bennybobw/sources/node-v0.2.4/tools/wafadmin/TaskGen.py", line 54, in ?
    class task_gen(object):
    File "/home/bennybobw/sources/node-v0.2.4/tools/wafadmin/TaskGen.py", line 87, in task_gen
    traits = Utils.DefaultDict(set)
    NameError: name 'set' is not defined
解决办法,下载python2.6并安装,

 python版本2.6.1

cd /usr/local/src/ 
sudo wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tgz
sudo tar -zxvf Python-2.6.1.tgz
cd /usr/local/src/Python-2.6.1
sudo ./configure
sudo make all
sudo make install
sudo make clean
sudo make distclean
sudo mv /usr/bin/python /usr/bin/python-bak
sudo ln -s /usr/local/bin/python2.6 /usr/bin/python

更新完python版本后回来继续
 ./configure 通过

make

node.js简介_第1张图片

后来发现yum也不能用了

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.6.1 (r261:67515, Feb  8 2012, 19:22:40)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq


然后继续百度,发现原来是更新python版本出现的问题,

解决办法:

修改yum文件
#vi /usr/bin/yum

网络上有网友是
将 #!/usr/bin/python 修改为 #!/usr/bin/python2.4

而我也这样修改则不行,随后我查看了下/usr/bin目录下有个python3,修改为#!/usr/bin/python3后正常

运行 yum,ok!

 yum好了后继续看上面make的报错问题:

百度之后发现说是gcc版本问题,我机器的gcc版本是3.*,而node要求4.*的所以又进行了gcc的升级操作。

gcc升级步骤略过。。。。。。。。。

等待gcc升级完成后,

make      ok

make install   ok

到此安装完成

你可能感兴趣的:(node.js)