Node cannot get environment variables

clipboard.png
has set the environment variable in / etc/profile, which can be printed directly on the command line, but it is not available in the node program with "console.log (process.env.NODE_COUNTRY)". Currently, it is also logged in by root users. what may be the reason for this?


has been resolved. The problem is that the Linux server needs to be restarted before node can obtain the environment variables


execute the following two sentences to see if the output is normal?

 export NODE_COUNTRY=1234
 node -e 'console.log(process.env.NODE_COUNTRY)'
Menu