I was so frustrated that i decided to write my own 11-digit phone number format philippines module based on dotenv to solve this problem and make loading environment variables more convenient. The result is node-env-run or nodenv . loads a file .env, initializes the values using dotenv, and then runs your script. You can install it globally, but i recommend using it only for development purposes and at the local project level.

Install it by running: bash copy the code npm install node-env-run --save-dev then create a file nodenv-example.js and insert this code into it: javascript copy the code console.log('the value for foo is:', process.env.foo); as you can see, we don't need to call anything here. This is just the application logic. First try running it using node : bash copy the code node nodenv-example.