dimanche 22 février 2015

process.env.NODE_ENV not matching 'development' no matter what

Just migrated on the latest Express, and stuck in something completely simple. So, how is it possible, that this distilled example:



var env = process.env.NODE_ENV || 'development';
console.log(env);
if ('development' == env) {
console.log('im here');
}
else {
console.log('nah');
console.log(env);
}


with this server file runned as SET NODE_ENV=development & node server.js


gives output:



development
nah
development


instead of



development
im here


By the way, if I'll just manually set var env = 'development' then it work as it should be.


express 4.11.2, node 0.12.0, win8 x64.


Aucun commentaire:

Enregistrer un commentaire