Tell us what’s happening:
cannot get the dotenv working in

it said this :slight_smile:
Error: ENOENT: no such file or directory, open ‘.env’

Does anyone have a clue about this ??

Challenge: Set up Passport

Link to the challenge:

Hello there,

You will need to create a .env file, if you have not already. Also, it appears you have a syntax error on the first few lines of the server.js file.

As something you should take note of: The whole Advanced Node and Express section has been rewritten, and the boilerplate has changed. These changes will come into production view, within the next few days. After this, it will be very likely you will need to repeat some lessons, otherwise the following lessons will not work. With the current tests and boilerplate, there are a few issues.

If you want to track the change, here is the boilerplate PR. Once the lesson changes are merged into production, this PR will be merged to reflect these changes:

Hope this helps

1 Like

here is my repl could you check it and tell me what’s wrong ?

I believe there is a problem in my code or there is something wrong in the repl environment that I can fix, yes I am with you that there is errors in the code of The whole Advanced Node and Express section, but this error is in my code or sth in

I created the .env file in the root and when I console the proccess.env.VARIABLE it is undefined, this may be because the .env file I created is not really a .env file can you help me fix this problem ?

sorry for bad english :slight_smile:

I cannot see this type of code anywhere except for:

app.listen(process.env.PORT || 3000, () => {
          console.log("Listening on port " + process.env.PORT);

As far as I can tell, you do not have a .env file. To create one, you need to click the add file button in, above the workspace tab, and create one named .env including the dot (.)

Once that is done, you name variables using this strict syntax:


There is no ending ; (semi-colon), and no space between the = (equals)

Hope this helps