0

I'm running through a series of Pluralsight tutorials on NodeJS and have a directory with ~10 JS files in proving various concepts.

Every time I want to F5 debug my code, I have to ensure that my "program:" param is set to the current javascript file, which is pretty annoying.

Is there a way of dynamically doing this to save me needing to double check every 3 minutes?

If I simply take out the file name but leave "program:" I get the following error:

Cannot launch program 'C:\node\NodeJS Pluralsight\js'; setting the 'outFiles' attribute might help.

Here's my current launch.json:

"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceRoot}/js/currentFile.js", // What I'd like to change
        "outFiles": [ "${workspaceRoot}/**/*.js" ]
    },
    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Process",
        "address": "localhost",
        "port": 5858
    }

1 Answer 1

2

Fixed this accidentally by rescoping my directory to a nested directory inside my project folder, that subsequently recreated the launch.json file. The configuration array is now:

"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${file}"
    },
    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Process",
        "address": "localhost",
        "port": 5858
    }
]

where ${file} has been used to represent the current file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.