title: VSC debugging Node.js Typescript running on WSL
body: <p>I'm trying to debug Node.js app written with Typescript, running on WSL.</p>
  
  <p>Environment is:</p>
  
  <ul>
  <li>OS: Windows 10</li>
  <li>Debug tool: VSC 1.24.1 / VSC 1.25 / VSC 1.26.0</li>
  <li>WSL: Ubuntu 18.04</li>
  <li>Application: Typescript Node.js, codes from <a href="https://github.com/Microsoft/TypeScript-Node-Starter" rel="nofollow noreferrer">https://github.com/Microsoft/TypeScript-Node-Starter</a></li>
  </ul>
  
  <p>My launch.json is:</p>
  
  <pre><code>{
  "version": "0.2.0",
  "configurations": [        
  
      {
          "type": "node",
          "request": "launch",
          "name": "Launch via NPM",
          "runtimeExecutable": "npm",
          "runtimeArgs": [
              "run-script",
              "debug"
          ],
          "port": 9229,
          "useWSL": true,
          "console": "externalTerminal",
          "timeout": 100000,
          "restart": true,
          "sourceMaps": true
      }
  ]
  </code></pre>
  
  <p>}</p>
  
  <p>When I press F5, it does not stop at Debug breakpoints and saying "benerated code not found".
  But when I look at dist folder, it has *.map files.</p>
  
  <p>Could you please help me to figure it out?</p>
  
  <p>And is there any way to remote-debug the Typescript node.js app running on WSL?
  I could not find the solution.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>--Update--</strong></p>
  
  <p><strong>VSC 1.25 has a bug regarding remote debug, please try 1.24.1 or 1.26</strong></p>
  
  <p>Instead I found how to attach it and debugger works.  launch.json needs the below:</p>
  
  <pre><code>        {
          "type": "node",
          "request": "attach",
          "name": "Attach WSL",
          "port": 9229,
          "sourceMaps": true,
          "localRoot": "${workspaceFolder}",
          "remoteRoot": "/mnt/c/prj/tmp/TypeScript-Node-Starter",
          "outFiles": [
              "${workspaceFolder}/dist/**/*.js"
          ]
      },
  </code></pre>
  
  <p>To test, set break point at home.ts:8, and load "localhost:3000" from your brower.</p>
  
  <p>It might miss it at first try (I know it sounds weird), but reload once again.
  When you set a breakpoint, it might complain saying "unverified ..." or "not yet bound".  However when codes run, it will be verified.</p>
  
  <p>Happy debugging life!</p>