nodejs 第一课 安装

第一课  安装nodejs

linux 安装node.js
1.下载node.js最新稳定版本
2.解压,编译,安装
如下命令(以我本机目录)
#cd /usr/local/node-V0.4.8
#./configure
#make
#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

 

2011-03-11

 

  1. cd /usr/local/src/   
  2. sudo wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tgz   
  3. sudo tar -zxvf Python-2.6.1.tgz   
  4. cd /usr/local/src/Python-2.6.1   
  5. sudo ./configure   
  6. sudo make all   
  7. sudo make install   
  8. sudo make clean   
  9. sudo make distclean   
  10. sudo mv /usr/bin/python /usr/bin/python-bak   
  11. sudo ln -s /usr/local/bin/python2.6 /usr/bin/python  

 

 

这个时候重新configure  发现如下错误:

../deps/c-ares/ares.h:507: visibility arg must be one of "hidden", "protected" or "internal"
../deps/c-ares/ares.h:509: visibility arg must be one of "hidden", "protected" or "internal"
../deps/c-ares/ares.h:511: visibility arg must be one of "hidden", "protected" or "internal"
../deps/c-ares/ares.h:524: visibility arg must be one of "hidden", "protected" or "internal"
../deps/c-ares/ares.h:528: visibility arg must be one of "hidden", "protected" or "internal"
../deps/c-ares/ares.h:531: visibility arg must be one of "hidden", "protected" or "internal"
Waf: Leaving directory `/root/node/build'
Build failed:  -> task failed (err #1): 
        {task: cc ares_free_string.c -> ares_free_string_1.o}
make: *** [program] 错误 1 

 

google一下发现是因为本地gcc版本太低造成的,

下面就要升级gcc到4.6

http://gcc.gnu.org   获得最新版得gcc  安装。。。。待续

 

NodeJS初探之一——神秘的服务器端JS

 http://www.iteye.com/topic/968660

http://witcheryne.iteye.com/blog/1161232 

 

nowjs

http://nowjs.com/guide 

posted @ 2011-11-01 15:04  方子尚  阅读(488)  评论(0编辑  收藏  举报