I want to read all shell environment variables in Node.js.There is a similar
answer.But I find process.env
cannot read customize variables.
as you can see ,process.env does not include some variables such as JAVA_HOME
NVM_DIR
.
How to get them?
I can see two ways:
read
/etc/profile
and~/.bash_profile
then calculate what variables user set .or to call shell command
env
in nodejs.
But there are too complex. Is there a simple way to get them?