Oscar
Oscar

Reputation: 13960

Can't execute express application with visual studio code

I can't run a newly created express project with vscode. It simply fails with a message saying: "Cannot launch program 'xxxx'; setting the 'outDir' attribute might help."

My main executable file is in bin/www

├── app.js
├── bin
│   └── www

Using vscode Version 1.12.1

Commit f6868fce3eeb16663840eb82123369dec6077a9b

Date 2017-05-04T21:40:39.245Z

Shell 1.6.6

Renderer 56.0.2924.87

Node 7.4.0

on Linux 4.8.0-51-generic #54-Ubuntu SMP Tue Apr 25 16:32:21 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

This is my launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/bin/www",
            "protocol": "inspector"
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Process",
            "address": "localhost",
            "port": 5858
        }
    ]
}

What can I do?

Upvotes: 1

Views: 517

Answers (1)

TimHayes
TimHayes

Reputation: 3724

Your program value should point to your express script. Like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/app.js",
            "protocol": "inspector"
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Process",
            "address": "localhost",
            "port": 5858
        }
    ]
}

Upvotes: 2

Related Questions