A new `process.loadEnvFile` function was (relatively) recently added to nodejs (https://nodejs.org/docs/v24.5.0/api/process.html#processloadenvfilepath)
If you can modify the script that you want to run, you can add:
process.loadEnvFile(".env");
And that will load your environment variables from the .env file into your `process.env `.
You can also create a wrapper script as mentioned by @RobC using this to load the .env file instead.
Even easier, more recent and also safer (according to the severe security warnings I got from installing dotenv in npm) than the dotenv package. :)