NTVS and Express 4

Nov 23, 2014 at 2:46 PM
I had a project with Express 4 and then imported it to VS. Then in project properties I set the DEBUG environment variable and pass bin/www as node parameters, but even if the app starts, the debugger don't work.
Is there any way of using Express 4 with NTVS? If there isn't, would it be supported in coming dates?
Coordinator
Nov 23, 2014 at 8:01 PM
Can you describe what "debugger don't work" manifests as, in detail? Also, make sure that you're doing Project -> Start with Debugging.
Nov 27, 2014 at 9:36 PM
Thanks for your time and forgive me for don't replaying before.

With "debugger don't work" I mean that VS builds my project, shows the Express console, and starts the web server process, buth when I navigate to certain url, even if data is returned,the debuger doesn't break ,breakpoints never get hit.

I guess the point is more about the fact of me creating an Express 4 project outside VS and then importing it as a node project. Maybe as the version number means, there are breaking changes between Express 3 and 4 version, the former been the one used by NTVS.

I updated to the current release NTVS 1.0 RC, and still cant get the breakpoints to work. The Express process starts, and if I browse to an url in return data, but the brekpoint in the IDE inside the route function never get hit and there is also no error messages.

NTVS Express projects requires an specific Express version to work?
Coordinator
Dec 1, 2014 at 6:32 PM
I created an express 4 project using express-generator@4.9.0, then used New Project from Existing Code, and my breakpoints in routes/index.js and routes/users.js are getting hit as expected.

The only known issue I had to work around is not being able to set bin/www as the startup file. It can be done by renaming it to www.js, set as startup, then rename back to www.

I suspect it has more to do with the complexity of the code around the callback. I wonder if you can repro with a freshly generated project like I did? In any case, if you can get a consistent repro, we would appreciate step-by-step instructions, or a project we can use.

Also, which version of Node are you using?
Dec 1, 2014 at 7:54 PM
Edited Dec 1, 2014 at 8:05 PM
Ok, I had sometime more to explore and realized that the problem was that I imported an Express 4 project, and visual studio some how didn't realized it was an Express project and returned immediately without attaching to the express server process.
So, I created a new Express 3 project from scratch, and without downloading any dependencies, modified app.json to use Express 4.9.0 and other related software. Then, I manually could move all my other files and now I can debug it fine, no errors yet. Just changed some properties in project configuration to run express > 4.0 projects, about DEBUG environment variable and setting ./bin/www as start-up item. Yes, I also had to change it's file extension to js.

Image

The imported Express 4 project somehow didn't get attached to the debugger neither reported any errors. The manually imported solution is working and runs fine.
Notice that I was able to debug previous code without NTVS using node-inspector, so I don't think that was the problem.

Running node v0.10.28 W7 x64.

Thanks for your time and help.