0

I have set export NODE_ENV=development already.

script.js

const nodeEnv = process.env.NODE_ENV;
console.log(nodeEnv);

1.) when script is started with node script command, nodeEnv variable is assign to value 'development'

2.) however when script is started with Run and debug (vscode) variable is undefined

Why are those results different ?

Juraj Zovinec
  • 226
  • 1
  • 15

1 Answers1

2

I had the same problem some weeks ago. I use Linux, but there is already a question similar to this one. Answers to this question helped me to resolve my issue

Adding "env": { "NODE_ENV": "development" } to vscode laucher.json config might do the trick.

Nejat Njono
  • 254
  • 4
  • 9