# node-debug
**Repository Path**: mirrors_leecade/node-debug
## Basic Information
- **Project Name**: node-debug
- **Description**: node debug note
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-09
- **Last Updated**: 2026-02-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# node-debug
node debug note
## Considering
- Hot config
- Remote control
- AOP monitoring
- Friendly debug node in chrome
## DEMO
1. run a example server
```js
node example/server.js
```
> Visit http://localhost:8001 to see the message
record the `pid`, then
2. enter debug mode and connect by the `pid`
```js
node example/debugger.js `pid`
```
Refresh the browser, you may see content has changed
----
## About node debug
### How to enter debug mode
- Way 1
startup with `--debug-brk` param
```js
node --debug-brk=5858 [filename]
```
- Way 2
Send a `SIGUSR1` signal to node process
> For example
```bash
$ kill -SIGUSR1 4162
```
When node process enter debug mode, there will open a TCP port for listen (default port is `5858`)
### Connect a debug process
```js
node debug localhost:5858
```
Then the process is hang on, type these basic commands:
c Go on
s Step into next function
o Step out of current function
### Debugger protocol
simple:
```js
var msg = {
'command': 'evaluate',
'arguments': {
'expression': 'global.message="' + 'newMessage' + '"',
'global': true
}
}
```
send the message:
```
client.req(msg, function (err, body, res) {})
```
### Ref
https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md
https://github.com/joyent/node/blob/master/lib/_debugger.js
https://github.com/oneapm/node-oneapm-debugger