Can't read my environment variable in my Node.js app

You need to export shell variables in order to make them available to processes you execute in your shell.

Compare the output of this command:

FOO=bar; bash -c 'echo $FOO'

with the output of this:

export FOO=bar; bash -c 'echo $FOO'

I found my way here from something really silly.

I had just added the new exported variables, but my node process still wasn't seeing them. Then I realized it wasn't enough to restart the node process—I had to open a new terminal (ie. bash instance) too. Once I did this, it worked fine :)