MongoDB and Mongoose - Install and Set Up Mongoose-dependancies

I installed MongoDB and Mongoose but when I test it still says that they need to be installed.

Using repl.it and this is what my package.json file looks like:

{
	"name": "fcc-learn-node-with-express",
	"version": "0.1.0",
	"dependencies": {
		"body-parser": "^1.15.2",
		"cookie-parser": "^1.4.3",
		"express": "^4.17.1",
		"fcc-express-bground": "https://github.com/freeCodeCamp/fcc-express-bground-pkg.git",
		"mongodb": "^3.6.3",
		"mongoose": "^5.10.15"
	},
	"main": "server.js",
	"scripts": {
		"start": "node server.js"
	},
	"engines": {
		"node": "4.4.5"
	}
}

I’m connected to the database and everything but for some reason all three tests fail.

Welcome, jcaber.

Would you mind sharing a link to your project code? The lesson requires you to do more than just add the packages.

For Repl.it, keep in mind, the app needs to be running in the background. If you hit run and see any errors in the console/logs, then the tests will not work.

Have you correctly:

  1. Created a .env file
  2. Added a variable with your database URI as the value
  3. Connected to the database with:
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });

My project is here: https://repl.it/@jcaber4/boilerplate-express

I’m almost positive I created my .env file correctly.

Have you sent the wrong link?

Because the boilerplate for these lessons looks like:

1 Like

wow thank you. I feel really dumb now lol

If like me and none of this works for you then execute npm install mongodb --save in the terminal the run your reply again and it will work