安装:
前提:安装好python2.6或2.7,我安装的是2.6.6
下载:http://nodejs.org/dist/v0.6.1/node-v0.6.1.tar.gz
解压: tar -xvf node-v0.6.1.tar.gz
cd node-v0.6.1
./configue
make
sudo make install
检查是否安装成功:
node -v
显示:v0.6.1
通过例子测试:
1 var http = require('http');
2 http.createServer(function (req, res) {
3 res.writeHead(200, {'Content-Type': 'text/plain'});
4 res.end('Hello World\n');
5 }).listen(1337, "127.0.0.1::137");
6 console.log('Server running at http://1270.0.1:1337/');
在命令行中执行它:
node example.js
你就可以通过浏览器访问http://127.0.0.1:1337得到Hello World的响应。
参考资料:http://www.nodebeginner.org/index-zh-cn.html
https://github.com/joyent/node/wiki/Installation