Remote debugging of Node.js applications and code on WebKit browsers
The article will discuss Must Have tools for remote debugging of Node.js applications or code on WebKit browsers node-inspector .
For debugging code in the browser, in principle, remote debugging is not needed, apart from mobile devices, where it is actually not possible because it is extremely inconvenient. Quite another thing with server-side JavaScript. Node.js has several debuggers that mainly promote ndb Node Debugger, a console utility for debugging Node.js applications. Suitable only for console fans or for masochists. It's not convenient to work, debugging is long, compared to debugging code in the same FireBug.
What node-inspector can do: 1. Remote debugging 2. Debugging in the WebKit-debugger GUI (You don’t need to install anything on the client - you already have everything) 3. Editing 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 Code ')
Function context
Installation
Requirements node, npm npm install node-inspector
Launch
1. We start the inspector in the background node-inspector & node-inspector will launch a web server, which by default will listen to all incoming connections to: 8080 2. And run our script node --debug path/to/yourprogram.js node will open debug interface on port 5858 3. Open any desktop WebKit browser - better Chrome and follow the link http://YOUR-SERVER-IP:8080/debug?port=5858Important: the URL must be IP 4. Chrome will open the debugger interface (as in the 1st screenshot) 5. We rejoice and debug remotely
Using
The project is watched by about 500 users and it is booming. If you find bugs or have questions - node-inspector , node-inspector wiki
PS At first I wanted to post a comment to the previous topic-link about remote debugging habrahabr.ru/blogs/javascript/114811 but the comment was too long, so I decided to issue an article.