I am facing an issue where I need to retrieve data from a .env.local file, but instead of fetching the data from the file in the current folder, it is pulling the information from another project that I previously created. How can I instruct node.js to identify and read the correct file?
For example:
folder:
file.js
.env.local
In my JavaScript file:
const envData ={
test1: process.env.TEST_1,
test2: process.env.TEST_2,
test3: process.env.TEST_3,
})
The contents of .env.local file are:
TEST_1=test1-data
TEST_2=test2-data
TEST_3=test3-data
The problem lies in the fact that I am not able to access the data from the .env file in my current folder, but rather it is reading from another directory. How can this be resolved?