Remote debugging of Node.js applications and code on WebKit browsers
The article will talk about Must Have tools for remote debugging of Node.js applications or code on node-inspector WebKit browsers .
For debugging code in a browser, in principle, remote debugging is not necessary, apart from mobile devices, where it is actually not possible because it is extremely inconvenient. Quite a different matter with server-side JavaScript. Node.js has several debuggers, they mainly promote ndb Node Debugger - a console utility for debugging Node.js applications. Only suitable for console fans or masochists. It’s not convenient to work, debugging is long compared to debugging code in the same FireBug.
What can node-inspector do:
1. Remote debugging
2. Debugging in the WebKit-debugger graphical interface (You do not need to install anything on the client - you already have everything)
3. Editing the runtime code !
4. Uses WebSockets, and no polling!
5. Remote profiling of code blocks using v8-profiler
View Source
Function Context
Node, npm requirements
1. Run the inspector in the background
node-inspector will launch a web server, which by default will listen to all incoming connections on: 8080
2. And run our script, the
node will open the debugging interface on port 5858
3. Open any desktop WebKit browser - Chrome is better and go to link
4. Chrome will open the debugger interface (as in the 1st screenshot)
5. Rejoice and debug remotely
The project is watched by about 500 users and it is booming.
If you find bugs or you have questions - node-inspector , node-inspector wiki
PS First I wanted to post a comment on the previous topic link about remote debugging habrahabr.ru/blogs/javascript/114811 but the comment came out too long, so I decided to issue an article .
For debugging code in a browser, in principle, remote debugging is not necessary, apart from mobile devices, where it is actually not possible because it is extremely inconvenient. Quite a different matter with server-side JavaScript. Node.js has several debuggers, they mainly promote ndb Node Debugger - a console utility for debugging Node.js applications. Only suitable for console fans or masochists. It’s not convenient to work, debugging is long compared to debugging code in the same FireBug.
What can node-inspector do:
1. Remote debugging
2. Debugging in the WebKit-debugger graphical interface (You do not need to install anything on the client - you already have everything)
3. Editing the runtime code !
4. Uses WebSockets, and no polling!
5. Remote profiling of code blocks using v8-profiler
A couple of screenshots that explain everything
View Source
Function Context
Installation
Node, npm requirements
npm install node-inspector
Launch
1. Run the inspector in the background
node-inspector &
node-inspector will launch a web server, which by default will listen to all incoming connections on: 8080
2. And run our script, the
node --debug path/to/yourprogram.js
node will open the debugging interface on port 5858
3. Open any desktop WebKit browser - Chrome is better and go to link
http:
//YOUR-SERVER-IP:8080/debug?port=5858
Important: the URL should be exactly IP 4. Chrome will open the debugger interface (as in the 1st screenshot)
5. Rejoice and debug remotely
Using
The project is watched by about 500 users and it is booming.
If you find bugs or you have questions - node-inspector , node-inspector wiki
PS First I wanted to post a comment on the previous topic link about remote debugging habrahabr.ru/blogs/javascript/114811 but the comment came out too long, so I decided to issue an article .