Ask coding questions

← Back to all posts
ENOENT: no such file or directory, open '.env'
lungera (1)

Hi, I created a repl, added a .env file but when I run it, it says there's no .env file.

Commentshotnewtop
a5rocks (732)

That may not be possible for all I know. However, you can just use process.env.<VARIABLE NAME>

lungera (1)

@a5rocks it worked a few days ago and I can't use process.env because it's not a proper env file.

a5rocks (732)

@lungera hmm what are you trying to put into the .env file? Just do something like:

CONTENTS=lol pretend this was what was in your file.

Then just process.env.CONTENTS

lungera (1)

@a5rocks the content is multiple lines.

AdCharity (1110)

Bruh are you using fs to open a .env file
1. Don’t do that 2. Don’t do that 3. A5rocks knows what’s up

lungera (1)

@AdCharity I'm trying to hide some code, not variables.

AdCharity (1110)

@lungera you can’t do that so get a hacker account but paying money or winning repl sponsored events. Or just make some random obscure account - it’s not like people will be able to find you if you don’t comment or post anywhere