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 ?

1 Answer 1

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.

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

2 Comments

Hey Thanks for your quick answer, this config has fixed it !
Cheers Boss. Happy Coding!!

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.