node-webkit only inherits environment variables from the bash profile if it is run from the shell. On OSX:
... Works great!
If you want to pull in all environment variables from the user's bash profile when launched from a GUI, you'll have to run the default shell in a child process and parse the environment:
function get_env(callback) {
var sh = require("child_process").spawn("sh", [
"source ~/.bash_profile; env"
sh.stdout.on("data", function (data) {
result += data.toString();
sh.on("close", function () {
var lines = result.split("\n");
for (var i = 0; i < lines.length; i++) {
var kv = lines[i].split("=", 2);
document.write(JSON.stringify(env));