Basic Node and Express - Use the .env File

Tell us what’s happening:

My json file is not able to access the my .env file. I even tried logging message. Here is my code below:

.env file:

myApp.js file:
let express = require(‘express’);
let app = express();

const message=process.env[‘MESSAGE_STYLE’];
if (message === “uppercase”){
message:“Hello json”.toUpperCase()
else {res.json({
message:“Hello json”

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

Basic Node and Express - Use the .env File

hi and welcome to the forum.
Did you setup your .env file in the root path of the project?
You should also follow the steps listed at the end of the instructions if you are working locally as you will need the dotenv package as mentioned.

I’m using gitpod. I did create the file on the root directory.

you did not answer if you are using dotenv or not

Do I need to install the .env package if I’m using gitpod?

it’s a sort of local environment, follow the instructions for dotenv

1 Like

I noticed multiple people have had this issue. Maybe we should get an issue opened and get the text updated to mention that gitpod counts as a local env?