Afer modifying TypeScriptOutDir breakpoints is never hit

I am using Visual Studio Professional 2013 Update 3 and I have created a Node console application with a "hello world" log statement. If I set a breakpoint in this instruction and then start the debugger, it works fine. It hits a breakpoint and then I can debug as expected (just to make it clear that my .map files are generated and are working correctly).

Now I clean up the project (remove the generated app.js and files). I edit the .njsproj file and add:



I reopen the project, update the download file path to add an extra "\ lib" folder, and I start debugging. It runs the code but doesn't hit a breakpoint.

Why doesn't it hit a breakpoint? How does Visual Studio vulnerability detection work for typescript projects (node.js) because no .pdb files are generated during compilation? And how can I fix this so that I can debug the compiled code that is not located in the same folder as the source files?

Any suggestion, idea, feedback would be really appreciated. Thank.


Checking the file generated in "\ lib". I can see how the .ts file link has an extra "..". So the link is fine. In any case, it seems that the problem is in the hit detection in the .js file and not in the mapping of .js strings to .ts.


Steps to reproduce:

  • Create a new project "Empty Node.js Console Application".
  • Unload the project.
  • Modify .njsproj xml and add this line: <TypeScriptOutDir>lib</TypeScriptOutDir>

  • Refresh the project.
  • Update the startup file in the project by adding the path to \ "\ lib".
  • Open the "app.ts" file.
  • Set a breakpoint on a unique line of code "1. console.log (" Hello world ")"
  • Start debugging.

Result: app.js is created in the "\ lib" folder, VS runs the file with node, it prints "Hello world" and finishes. No breakpoint.

Is it possible that setting breakpoints over a .ts file always assumes that the generated .js file will be in the same folder as the .ts file?

I tested the installation on "lib" as well with no success in that the break clause in the .ts file was cracked.


If I set a breakpoint directly over the file generated in "\ lib \ app.js" it gets hit and Visual Studio starts debugging, but I still need it to work by setting breakpoints on the .ts files.


Using a debug working draft (without the TypeScriptOutDir line in .njsproj), I manually modified the file where it says:

"sources":["app.ts"] to "sources":["app.ts"]


I changed it to app2.ts:

"sources":["app.ts"] to "sources":["app2.ts"]


app2.ts is not an existing file. When we start the project, the breakpoint is not hit. I have also tried with absolute path:



and it works as well, but again, if pointing to a non-existent file, it doesn't work:



It looks like the file is responsible for mapping the breakpoints we set in the .ts file to lines in the .js file.

Then what is wrong with the file generated in the lib folder? If we look at this file, we can see a link to the .ts file in the previous folder:



This should be fine, since the path from "/lib/app.js" to "app.ts" is "../app.ts". But the result when we run the project is that the breakpoint is not hit.

Why? I have no idea and this is what I need to figure out.

I have also tried manually modifying these links between relative and absolute without any success ...

I created two "Node.js console application" projects and set a breakpoint in the "hello world" log statement.

NodejsConsoleAppHit is the one with no TypeScriptOutDir configuration. This is the one that generates files in the project root folder and hits the breakpoint.

NodejsConsoleAppNoHit is the one with the TypeScriptOutDir config. This is the one that generates files in the lib folder and doesn't hit a breakpoint.


source to share

1 answer

As per this work item on Node.js Tools for Visual Studio on CodePlex:

The question was taken into account and corrected. I've tested it myself with "NTVS 1.0 RC VS 2013" and it seems to work fine.

You can get it by selecting "NTVS 1.0 RC VS 2013" from the NTVS download page:

or right here:

I have to say that we used the node-inspector ( ) for debugging at this time and this is a tool that works really well and solves all our problems.

Personally, the search for VS integration is more convenient for us. This is a matter of taste, as after this update of Node.js tools both look fine.



All Articles