nodejs-shopping-cart
nodejs-shopping-cart copied to clipboard
Can't connect to mongoDB
I am using mlab remote mongoDB and get this message added the connection uri to the .env. I have node v 7.2.1, npm 4.0.5
MongoError: failed to connect to server [undefined:27017] on first connect [MongoError: getaddrinfo ENOTFOUND undefined undefined:27017]
@mylastore its because your process.env.MONGO_DB_URI is undefined.
Before "npm start" you need to manually export MONGO_DB_URI variable with:
export MONGO_DB_URI=your_remote_mlab_uri
You can also setup dotenv on project to user an .env file.