Quantcast
Channel: Node.js Tools for Visual Studio
Viewing all articles
Browse latest Browse all 4630

New Post: Unable to enter debug mode

$
0
0
I've got the same issue,
I'm not much of a VS/Web developer - just starting with nodejs :)

I found a workaround (but doing this breaks debugging functionality)

Right click the project and choose properties
Under node.exe arguments put the full path of the server.js/app.js (you can right click it and choose copy full path)
When starting the project now, a new browser won't be opened, but the server will at least run and can be accessed using the browser.
screenshot:
Image

Not sure if the following is helpful but may give someone an idea:
Created a new node app with the following code:
console.log("0");
var http = require('http');
console.log("1");
var port = process.env.port || 1337;
console.log("2");
http.createServer(function (req, res) {
console.log("3");
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
}).listen(port);
console.log("4");

I don't see "0","1","2","3","4" logged on the console.

When I look at what's being run using procmon, it's the following command line:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Node.js Tools\1.0\Microsoft.NodejsTools.PressAnyKey.exe" abnormal C:\Users\myusername_000\AppData\Local\Temp\tmpE7A4.tmp "C:\Program Files\nodejs\node.exe" --debug-brk=5858 "c:\temp\NodejsApp1\NodejsApp1\server.js"


From the documentation at: https://www.npmjs.org/package/node-inspector
it's noted that:
My script runs too fast to attach the debugger.

The debugged process must be started with --debug-brk, this way the script is paused on the first line.


netstat -ano shows:
netstat -ano | Select-String "5858"

TCP 127.0.0.1:5858 0.0.0.0:0 LISTENING 2140
TCP 127.0.0.1:5858 127.0.0.1:21323 ESTABLISHED 2140
TCP 127.0.0.1:21323 127.0.0.1:5858 ESTABLISHED 11920
TCP 127.0.0.1:21323 127.0.0.1:5858 ESTABLISHED 11920

process 11920 is devenv
process 2140 is node

I used rawcap to take a look at the traffic on 127.0.0.1 with the debugger, at least on the surface it seems that VS is talking to the debugger.
I'm guessing this is expected and that node tools for VS should interact with the debugger to resume execution but that's not happening for some reason.

I'll be happy to send the procmon log/rawcap capture.

Viewing all articles
Browse latest Browse all 4630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>