如何在VS2015中debuggingnode.js应用程序?

鉴于:

  1. VS 2015(企业)全新安装
  2. 安装了VS的Node.js工具( https://www.visualstudio.com/features/node-js-vs )
  3. 安装了Node.js
  4. 使用基本Node.js Express 4应用程序项目模板创build一个新项目。

该应用程序运行正常,并按预期工作,但VS不尊重我设置的任何断点 – “断点不会被打中。此代码位置没有加载代码”是我得到的,而断点被禁用: 在这里输入图像描述

谷歌search是没用的。

有任何想法吗?

确保你生成源地图。

如果您的项目中没有tsconfig.json,请检查Visual Studio属性页。 在TypeScript Build选项卡下,确保selectGenerate source maps 。 示例Visual Studio属性页面 。

如果您使用tsconfig.json,请确保您在compilerOptions部分中生成源映射。

{ "compilerOptions": { "module": "commonjs", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "outFile": "../../built/local/tsc.js", "sourceMap": true } }