Be the first user to complete this post
|Add to List|
Find the environment variables of a nodejs process in linux
If you have an active nodejs process running on your system, the easiest way to check what environment variables it is using can be done in 2 simple steps.
- Identify the process id of your nodejs app
pe -ef | grep node
- Use the PID you found in the above step in the following command
The above command spits out a large bunch of key-valye pairs. You can always grep it for the variables you are interested in. e.g.
sudo cat /proc/PID/environ | tr \0 \n
To check the environment variables from within the code itself, simply log the value of the variable
sudo cat /proc/PID/environ | tr \0 \n | grep NODE_ENV
process.envanywhere in your code.
- Debugging nodejs applications using node-inspector and Chrome Dev Tools
- Resolved - sudo npm command not found
- Accessing the request body and session in nodejs using express
- gzip compress and cache api response in express
- nodejs: generate uuid / guid
- Understanding semver versioning for your nodejs packages
- Scaling a basic nodejs application using clusters
- Installing, Listing and Uninstalling packages using npm