Unable to find .env file - "Basic Node and Express - Use the .env File" challenge

Link to challenge: /apis-and-microservices/basic-node-and-express/use-the–env-file/ (I’m too new to post whole links here yet :confused:)

I know that the .env file is supposed to be a “secret” file but I hadn’t realized it’d be so hard to find. It seems I’m the only one with this problem. Everything on Google mentions either creating a .env file for specific projects or using the dotenv library to make working with .env easier but no FFC users seem to have had this issue so I must be missing something.

The challenge says " Let’s add an environment variable as a configuration option. Store the variable MESSAGE_STYLE=uppercase in the .env file." implying the env file is already there and server.js uses process.env I in my mind it must be there (but maybe not locally in my project?). Please advise :pray:

@throwawayffc Welcome to the forum.

Here the file .env

image

This file contain a key :old_key:

1 Like

Apparently you use vscode. You may have to change a vscode configuration. Did you download a copy of the github repository?

1 Like

I pulled the files from Github, not using Glitch for this. I suspect it wasn’t included on Github since Github flags users who post their env files

Possibly GitHub is the cause of the stuck. Now, if you want to work locally, Glitch offers you the download of all the files.

1 Like

That’s good to know about Glitch…

Creating a “.env” file seems to have worked so I think I’m good there.

Special shout out to you @yoelvis for the lightning fast relies and being more helpful than the internet in helping me work this out

1 Like

Just to clarify, there is nothing magical about a .env file. It is just another file. You should be able to see it (although some environments make all files that begin with a period hidden unless you do something to see them.)

By convention, we usually put something in the .gitignore file that tells git not to save that file on the repo. That way it is “secret” - visible to you but no one else can see it. In theory though, you could make any file a “secret” file or make the .env a regular file. But it is a common convention to use .env for things you need secret.

1 Like

thanks buddy . this challenge made me a little bit confused.

how did you figure out?