1.安装

node的安装很简单

linux下编译源码安装:

./configure 
make 
make install

windows安装就是一路next

安装完成后可以通过

node –v
npm -v

检查是否安装成功


2.简单运行

新建server.js

var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

保存

node server.js

用浏览器登陆localhost:1337

熟悉的hello world就出现啦。