2

Given:

  1. A brand new installation of VS 2015 (enterprise)
  2. Installed Node.js Tools for VS (https://www.visualstudio.com/features/node-js-vs)
  3. Installed Node.js
  4. Created a new project using the Basic Node.js Express 4 Application project template.

The application runs fine and works as expected, but VS does not respect any breakpoint I set - "The breakpoint will not currently be hit. No code has been loaded for this code location" is what I get instead and the breakpoints are disabled: enter image description here

Googling it was useless.

Any ideas?

mark
  • 59,016
  • 79
  • 296
  • 580
  • see if this link helps http://stackoverflow.com/questions/31167222/debug-java-script-with-visual-studio-2015-on-chrome-or-firefox – mike123 Apr 10 '16 at 17:06
  • @mike123 That link is discussing client-side JavaScript run within a browser. [Node.js](https://nodejs.org/) is a separate environment, commonly used for server-side JavaScript. – Jonathan Lonowski Apr 10 '16 at 17:08
  • Same problem, I installed Visual Studio Code. – Max Apr 10 '16 at 17:31
  • I'm using VS 2015 Enterprise Update 2 and I can't replicate the problem. The application immediately breaks. And when I click Continue it proceeds normally and opens a new browser window. What version is your VS 2015? Probably they fixed something in the update –  Apr 11 '16 at 04:39
  • I have Update 2 as well - see **EDIT 1**. – mark Apr 11 '16 at 04:49

1 Answers1

1

Be sure that you generating source maps.

If you do not have a tsconfig.json in your project, then check the Visual Studio properties page. Under the TypeScript Build tab, ensure that Generate source maps is selected. Example Visual Studio property page.

If you are using a tsconfig.json, make sure you are generating source maps in the compilerOptions section.

{
    "compilerOptions": {
        "module": "commonjs",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "outFile": "../../built/local/tsc.js",
        "sourceMap": true
    }
}
Eric Eubank
  • 11
  • 1
  • 2