Skip to content

How to set environment variables when running node.js app in vs2019 #2331

Open

Description

@sabrogden

I have a very simple node.js console app that most of the time and others on our team run in vsCode. This is just a folder with an index.js and package.json.

I would like to run this in visual studio. The problem I'm having is how to configure the environment variables and command line options. In vsCode we have a configuration in launch.json that defines things, this works good in vsCode.

But in visual studio I'm not sure how to set these. I have tried to set values in launch.vs.json but I'm not seeing the environment variables loading.

{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "nodeDbg",
"name": "Test.1",
"project": "index.js",
"projectTarget": "index.js",
"environment": {
"TEST_ENV": "test"
},
"args": [ "--JobKey=x", "--OverrideOrganizationId=y" ]
}
]
}

I'm not seeing the environment variables or args populating. Is this the correct way to set these? Different tags?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions