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并安装,
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
- 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
这个时候重新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}
google一下发现是因为本地gcc版本太低造成的,
下面就要升级gcc到4.6
从http://gcc.gnu.org 获得最新版得gcc 安装。。。。待续
http://www.iteye.com/topic/968660
http://witcheryne.iteye.com/blog/1161232
nowjs