motdotla / dotenv

Loads environment variables from .env for nodejs projects.
https://www.dotenvx.com
BSD 2-Clause "Simplified" License
19.01k stars 853 forks source link

The .env file on project root directory is always loaded although a path is set #828

Closed joeyhvh closed 3 months ago

joeyhvh commented 3 months ago

My problem is that always the .env file at the project root is loaded although I hand over a valid path. Here the code I call the config function.

import { config } from 'dotenv';
import path from 'path';

config({ path: path.resolve("E:/........./ENV-STORE/010.env") });
console.log(process.env);

I made a dummy .env on the top level of the project which is simple a=b. The right 010.env file has a completely key and value pairs. However in the env vars are loaded a: "b", . I dont think that there is a mistake with the dashes. I tried multiple ways with single / and \ and multiple \

I use WSL2 and bun as runtime in my typescript code. Thank you

joeyhvh commented 3 months ago

nvm my fault sry