Wednesday, 15 March 2017

[ANSWERED]vscode can't launch node app

I'm trying to set up a typescript-based express app workflow using Visual Studio Code & gulp.
Heres my project structure:
src/  <-- souce files
  Start.ts
  Server.ts
  models/
    Contact.ts
    Organization.ts
bin/  <-- compiled output
  Start.js 
  Start.js.map
  ...
tsconfig.json
gulpfile.json
package.json
.vscode/
  launch.json

Performing the following sequence of commands, I can compile & launch my app in the integrated terminal:
> tsc
> node --debug-brk ./bin/Start.js

At this point, I can successfully attach to my app using the default "attach to process" command (and it even hits breakpoints in the typescript files correctly, yeyy!):
{
    "type": "node",
    "request": "attach",
    "name": "Attach to Process",
    "address": "localhost",
    "port": 5858
}

However, launching with F5 fails every time. There is no output on the Debug Console, and in a few seconds I get an error banner at the top saying Cannot connect to runtime via 'legacy' protocol; consider using 'inspector' protocol (timeout after 10000 ms).
Here's my launch configuration (in launch.json):
{
    "type": "node",
    "request": "launch",
    "name": "Launch Program",

    // Using compiled .js file. vscode should use the sourcemap to correlate
    // with breakpoints in the source file
    "program": "${workspaceRoot}/bin/Start.js",
    "outFiles": [ "${workspaceRoot}/bin/**/*.js" ]
}

I tried opening the debug console. Every time I save the launch.json file, it gives me the following error: Cannot read property '_runner' of undefined: TypeError: Cannot read property '_runner' of undefined in shell.ts:426
Googling the error, I came across this bug
What does this bug mean? Is there any workaround for it? What oh what should I do???


via Julien

No comments:

Post a Comment