dotenv not loading process.env in node

  1. Install the dotenv package using npm: npm install dotenv

  2. Create a .env file in the root of your project and add the environment variables in the following format: VARIABLE_NAME=value

  3. Require the dotenv package at the top of your main file: javascript require('dotenv').config();

  4. Access the environment variables using process.env.VARIABLE_NAME in your Node.js application.