1、下载node:http://www.nodejs.org/download/
我是下载的exe的,免得安装,太麻烦。
2、加入node.exe所在的路径到系统变量中,同样是为了方便以后使用,如果你愿意每次跑个程序都要进一遍目录的话,也可以不加。
3、建个目录放js文件,然后写个js文件来跑一下:
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
console.log("nodejs start listen 8888 port!");
4、把js程序跑起来:
5、打开浏览器访问吧,你将看到: