.env files not recognised in a bash replit
TheBeast941

I discovered this in another repl, where I would create a .env file and attempt to access variables from it in index.js and it would return "undefined", then I would create a dotenv file and access the varibles from that and the variables would get returned just fine.

After wasting a few hours trying to get it to work, I created a new repl to test what would happen, and this was indeed the behaviour: from index.js using the module "dotenv" with a .env file would return undefined, and using any file other than .env would return the variable, as expected.

Is there any way for the index.js file to be able to read variables from the .env file? (Switching languages from bash to node.js is not an option since this completely breaks the script (the main repl) for some reason)

You are viewing a single comment. View All
TheBeast941

@Coder100 just realised i sent comments on my alt account,oops!
Anyways, I need .env because the repl above is not the main repl, I got another repl which has the same problem and i'm looking for a way around it so that no one else can see the variables being stored in the file