node -r dotenv/config script.js
Category: Node.js & npm/yarn
node -r dotenv/config script.js
Pre-require the dotenv package to load .env variables before your script runs
Pre-requires (loads before the main script) the dotenv package so .env variables are available from the very first line of your code.