abrkn abrkn - 1 year ago 57
Node.js Question

How can I set an environmental variable in node.js?

How can I set an environmental variable in node.js?

I would prefer not to rely on anything platform specific, such as running export or cmd.exe's set.

Answer Source

You can set your environment variables in process.env:

process.env['VARIABLE'] = 'value';

Node should take care of the platform specifics.