npm / run-script and environment variables

I'm having problems running npm tasks with environment variables. I have right clicked on the task and in the Edit Run/Debug configuration: 'start' dialog added my environment variable, but when I go to execute the 'start' task within my script the environment variable I set is undefined when accessed via process.env.VARIABLE_NAME. 

If I set up a Node.js configuration specifically to do the same as my npm 'start' task then the environment variables I set there DO get passed to the executing process, and are available in process.env.VARIABLE_NAME - however, there's often more complex tasks in npm that I just can't set up as Node.js Run/Debug configurations.

Just wondering if there's some sort of configuration option that I'm maybe missing...

1 comment
Comment actions Permalink

This is very strange... I couldn't get it going for the life of me before, but now it's working. I don't even know what has changed.


Please sign in to leave a comment.