process.env in Node.js
process | Node.js http://nodejs.cn/api/process.html process is a global object http://nodejs.cn/api/process.html#process_process_env demo in script: if (process.env.NODE_ENV === 'production') { module.exports = require('./prod.js') } else { module.exports = require('./dev.js') } input "node" line commend node > process.env // show value On Windows: set test=testValue on OS X or Linux: export test=testValue In js file process.env.test= 'dev'; package.json: "scripts": { "start": "set test=dev && node app.js" } ------------------------ Windows environment variant cmd > set test-env // exit set test-env=production set path=%path%;C:\web;C:\Tools set test-env= my computer -> property -> advance -> environment variant... ---------------------- Linux echo $test-env //check value of test-env // set value of test-env export test-env=production # attach va...