My ~/.bash_profile
content:
export MONGO_PATH=/usr/local/mongodb
export NODE_ENV=development
export PATH=$PATH:$MONGO_PATH/bin
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
# {{{
# Node Completion - Auto-generated, do not touch.
shopt -s progcomp
for f in $(command ls ~/.node-completion); do
f="$HOME/.node-completion/$f"
test -f "$f" && . "$f"
done
# }}}
However in my app.js code my process.env.NODE_ENV is undefined. I've searched for my issue but only find how to set it and I seemed to have followed "how to" correctly. Am I missing something?
Keep in mind you'll also need to reload the .bash_profile after editing it:
source ~/.bash_profile
or, alternatively:
. ~/.bash_profile
I think that something within your ~/.bashrc could be overwriting NODE_ENV
var, but it doesn't really matter, because if you want the default behaviour of your app.js
be to run as 'development' by default, you just should have something like:
var run_mode = process.env.NODE_ENV || 'development';
if(run_mode === 'development'){
// development mode
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With