SupraCoder
SupraCoder

Reputation: 95

Cannot access environment variable in desired file

I am trying to access environment variables in my Display.js, I have created a .env file in the root of my project, however, process.env is not logging my env variable.

.env inside of root folder of my project:

https://i.sstatic.net/WaKMQ.png

Display.js (located in same folder as .env):

https://i.sstatic.net/MJG80.png

Image of my folders:

https://i.sstatic.net/IlAsZ.png

Upvotes: 0

Views: 552

Answers (1)

Konrad
Konrad

Reputation: 24661

.env must be located of project root directory

Upvotes: 2

Related Questions