1,百度搜node.js,找到node.js官网 http://nodejs.org/ 下载node.js并安装
2,将下面代码放到一个js文件中。 我放在d:/myweb/test里,命名为test.js
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("test nodjs");
response.end();
}).listen(8899);
console.log("nodejs start listen 8899 port!");
3,然后在cmd,打开dos。找到你放上面js的文件夹,再node js文件名
D:
cd myweb/test
node test.js
这时个会出来 “nodejs start listen 8899 port!”
4,打开浏览器,地址栏输入 127.0.0.1:8899,不出错的话,应该会出来 test nodjs
至此,nodejs完成安装