title: Can I run/debug Heroku Node.js app locally with VSCode?
body: <hr>
  
  <h2>TL; DR</h2>
  
  <p>On <a href="https://code.visualstudio.com" rel="noreferrer">Microsoft VSCode v1.6.1</a>, how to:</p>
  
  <ol>
  <li>Properly set runtime executable?</li>
  <li>Properly pass <a href="https://devcenter.heroku.com/articles/heroku-local" rel="noreferrer">Heroku arguments</a>?</li>
  <li>Run <a href="https://devcenter.heroku.com/categories/nodejs" rel="noreferrer">Heroku Node.js</a> app?</li>
  <li>Debug <a href="https://devcenter.heroku.com/categories/nodejs" rel="noreferrer">Heroku Node.js</a> app?</li>
  </ol>
  
  <hr>
  
  <h2>Details</h2>
  
  <p>I have created a <a href="https://devcenter.heroku.com/categories/nodejs" rel="noreferrer">Heroku Node.js</a> application, which is launched using the CLI command:</p>
  
  <pre><code>heroku local web
  </code></pre>
  
  <p>and successfully starts at port 5000.</p>
  
  <p>I am trying to debug it using <a href="https://code.visualstudio.com/" rel="noreferrer">Microsoft Visual Studio Code</a>, using the following <a href="https://code.visualstudio.com/docs/runtimes/nodejs" rel="noreferrer"><code>launch.json</code></a> configuration:</p>
  
  <pre><code>{
      "name": "Launch",
      "type": "node",
      "request": "launch",
      "program": "${workspaceRoot}/app.js",
      "stopOnEntry": false,
      "args": [],
      "cwd": "${workspaceRoot}",
      "preLaunchTask": null,
      "runtimeExecutable": "/usr/local/bin/heroku",
      "runtimeArgs": [
          "local web",
      ],
      "env": {
          "NODE_ENV": "development"
      },
      "console": "internalConsole",
      "sourceMaps": false,
      "outFiles": []
  }
  </code></pre>
  
  <p>But VSCode is automagically passing <code>--debug-brk</code> argument to heroku, causing the error:</p>
  
  <pre><code>/usr/local/bin/heroku --debug-brk=23080 'local web' app.js 
      !    `--debug-brk=23080` is not a heroku command.
      !    See `heroku help` for a list of available commands.
  </code></pre>
  
  <p>VSCode also does not find heroku command without its full path (seems like it is not loading <code>PATH</code> environment variable).</p>
  
  <p>Any ideas about how to setup the editor?</p>