Exercise Tracker - MongoError: failed to connect to server

Issue Solved
If it helps anyone, if you happen to have this error, make sure you wrapped MLAB_URI between quotes (or double quotes).

Inside .env file —> YOUR_URI="X"

Tell us what’s happening:
I just “forked” Exercise Tracker project in glitch and there is already an error.

MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED]

I think it’s related to the following bit of code:

mongoose.connect(process.env.MLAB_URI || 'mongodb://localhost/exercise-track' )
  • I already declared MLAB_URI in .env file.
  • I tried deleting 'mongodb://localhost/exercise-track' from mongoose.connect()
  • The error appears as soon as I fork the project. You can easily try yourselves following this link or “link to the challenge” below.

Your browser information:

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

Challenge: Exercise Tracker

Link to the challenge: