Instead of using dotenv or similar libraries. You can just source the .env file on startup.
It's easy to add scripts via npm, so you can source the appropriate env file by running commands:
In your package.json:
scripts: {
"start-dev": "source dev.env; node server.js"
"start-prod": "source prod.env; node server.js"
}