Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS unresponsive when debugging (in VS Code)

Most of the time I can debug Node v4.2.1 projects in vscode perfectly but sometimes for no reason I can figure out Node becomes very slow to respond and I get messages like:

node did not respond to request to 'continue' in a reasonable amount of time

Does anyone have any idea what could be causing this and how to resolve it?

like image 325
antfx Avatar asked Dec 08 '15 09:12

antfx


3 Answers

I've been coping with this too, what i've done was to modify a file on the debug connector to extend the timeout, I guess it's a problem with my computer speed or something. Anyways, here's what i've done:

1- Open and edit the file nodeV8Protocol.js located inside VSCodeApp folder:

/Visual Studio Code.app/Contents/Resources/app/extensions/node-debug/out/node

2- Search the line where is initialized near the end of the file: Replace the default, wich is:

NodeV8Protocol.TIMEOUT = 3000;

By, for example:

NodeV8Protocol.TIMEOUT = 10000;

3- Save the file, and reload Visual Studio Code.

Hope that helps

like image 142
Gustavo Andrés Benitez Avatar answered Nov 01 '22 14:11

Gustavo Andrés Benitez


Try change 'node' to 'node2' in your launch config. Worked to me.

like image 24
Alcionei Estevam Jr Avatar answered Nov 01 '22 14:11

Alcionei Estevam Jr


Based on the suggestion from Alcionei-Estevam-Jr I've tried to use node2 in the launch configuration. It is no longer supported, however, but vscode kindly suggested to use node (as it was), and add "protocol": "inspector", (it requires a node version 6.3 or higher, though). This has fixed the unresponsiveness of node, and now, I can debug happily again.

So my launch config now looks like: json { "version": "0.2.0", "configurations": [{ "type": "node", "protocol": "inspector", "request": "launch", "name": "Launch Program", "program": "${workspaceRoot}/src/index.ts", "outFiles": [ "${workspaceRoot}/dist/**/*.js" ] }] }

like image 4
Erik Vullings Avatar answered Nov 01 '22 15:11

Erik Vullings