您的位置:首页 > Web前端 > Node.js

Nodejs chrome 调试配置 webcrt学习笔记

2014-08-21 12:58 197 查看
webcrt学习笔记

nodejs 安装和基本学习 参照《node.js开发指南.pdf》,其中遇到过 express 版本不同导致 书中例子不能正常运行,后来(为了正常运行)去除了一下功能;

之后又找来了 “expressSimpleBlog-master” 的项目做参考学习。现在为了 调试和学习webrtc 相关的内容,遇到了 配置nodejs调试的问题;

以下内容记录设置过程中的问题和有效地方法,内容来之网上收索。

Nodejs chrome 调试配置

转的 http://www.fwind.me/blog/617.html

通过node-inspector模块在chrome上调试nodejs程序.

1.安装node-inspector模块.

1

sudo
npm install
-g
node-inspector

2.启动node-inspector.

//默认端口
➜ ~ node-inspector
Node Inspector v0.5.0
info - socket.io started
Visit http://127.0.0.1:8080/debug?port=5858 to start debugging.

//指定端口
➜ ~ node-inspector --web-port=6000
Node Inspector v0.5.0
info - socket.io started
Visit http://127.0.0.1:6000/debug?port=5858 to start debugging.

1
2
3
4
5
6
7
8
9
10
11

//默认端口

➜ ~ node-inspector
Node
Inspector v0.5.0

info -
socket.io
started
Visit http://127.0.0.1:8080/debug?port=5858 to start debugging.

//指定端口

➜ ~ node-inspector
--web-port=6000
Node
Inspector v0.5.0

info -
socket.io
started
Visit http://127.0.0.1:6000/debug?port=5858 to start debugging.

3.启动要被调试的程序

//在有断点的地方,暂停.
➜ action-server git:(session) ✗ node --debug app.js
debugger listening on port 5858
info - socket.io started
------>Action-Server listening on port 9000

//程序启动开始就暂停,手动向下执行.
➜ action-server git:(session) ✗ node --debug-brk app.js
debugger listening on port 5858

1
2
3
4
5
6
7
8
9

//在有断点的地方,暂停.

➜ action-server
git:(session)
✗ node
--debug app.js
debugger
listening on port
5858

info -
socket.io
started
------>Action-Server
listening on port
9000

//程序启动开始就暂停,手动向下执行.

➜ action-server
git:(session)
✗ node
--debug-brk
app.js
debugger
listening on port
5858

4.在程序中打标记断点.

this.get_logout = function(req,res){
req.session.user = null;
debugger;//断点
res.send('logout ok');
}

1
2
3
4
5

this.get_logout
= function(req,res){

req.session.user
= null;
debugger;//断点

res.send('logout ok');
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: