1. 安装node.js
官网 http://www.nodejs.org ,下载和系统版本匹配的.msi后缀的安装文件
2. 安装 python2.7
官网 https://www.python.org/, 目前nodejs只支持 python2.7 。Python (v2.7.3 recommended, v3.x.x is not supported)
3. 安装 python 包 (这个可能不是必须的)
npm install python -g (安装)
npm config set python python2.7 (设定版本)
4. 安装 Microsoft Visual Studio C++ 2012 for Windows Desktop (Express version works too)
安装 VS 2010(需要msbuild.exe) http://download.microsoft.com/download/1/E/5/1E5F1C0A-0D5B-426A-A603-1798B951DDAE/VS2010Express1.iso (这个就可以了,免费的,只需要安装vc++ express)
vs2010 sp1 full :http://download.microsoft.com/download/E/B/A/EBA0A152-F426-47E6-9E3F-EFB686E3CA20/VS2010SP1dvd1.iso
iso文件安装需要虚拟光驱 ,可从百度软件中心下载 daemon tools Lite
5. 安装node-gyp (这个应该不是必须的)
npm install -g node-gyp
6. 安装node-inspector
npm install –g node-inspector
7. 使用node-inspector
启动node-inspector
node-inspector --web-port 8080 --debug-port 5858
用debug模式启动代码
node --debug-brk=5858 test.js
用chrome访问 http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
选择要调试的代码,加上断点进行调试
在新的浏览器tab或窗口访问 http://localhost:8888/ 触发断点
test.js代码如下:
(function (exports, require, module, __filename, __dirname) { var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
debugger
console.log('debugging');
response.end();
debugger
}).listen(8888);
});
//补充
win8 (64位系统)下,chrome浏览器必须是64的。
而且 Microsoft Visual Studio C++ 也必须去微软官网下载兼容win8的最新版免费express
//补充2
如果 Microsoft Visual Studio C++是32位的,则node.js 和 chrome 必须是32位的