Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Debugging with node-inspector

After long hours of googling and testing I did succeed debugging ClearScript code using node-inspector.

First of all, the latest version (0.12.3) has many extensions for debugging node.js scripts so I used an older version (0.5.0) which has less liability to node.js.

This is advised by the author of node-inspector in the following stackoverflow thread:


I used the following command to install v0.5.0.
npm install node-inspector@0.5.0
You must have node.js (https://nodejs.org/en/) installed on your computer to run this command. Execute it in Node.js command prompt.

It is installed in folder "%USERPROFILE%\node_modules" by default.

I added one line of code to %USERPROFILE%\node_modules\node-inspector\lib\PageAgent.js:

getResourceTree: function(params, done) {
return; //return empty tree

This completes the installation.

Here is the guide to debug a javascript file executed by ClearScript:

Open a command prompt and execute the following command:


You should see the following lines if node-inspector is running successfully.

Node Inspector v0.5.0
info - socket.io started
Visit to start debugging.

Initialize your V8 engine as in the following code line (VB):

Dim engine As New V8ScriptEngine("global", V8ScriptEngineFlags.EnableDebugging, 9222)

Put a breakpoint right after this line in your code and run your application to reach this breakpoint.

Make sure you have "debugger;" statement in the first line of your JavaScript code.

Open a Chrome browser and navigate to the following address:

Press "Continue Debugging" button in Vİsual Studio toolbar.

Now you should see your script code stopped at the first "debugger;" line in Chrome browser.

You can continue debugging from here.

Write in this thread if you have any questions.

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles

Latest Images