.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
Coder100

read this: https://docs.repl.it/repls/secret-keys

also your keys can't have spaces in them

try $test see what u get