jcaber4
November 18, 2020, 7:07am
1
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.
Sky020
November 18, 2020, 9:43am
2
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:
Created a .env
file
Added a variable with your database URI as the value
Connected to the database with:
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
jcaber4
November 19, 2020, 5:47am
3
My project is here: https://repl.it/@jcaber4/boilerplate-express
I’m almost positive I created my .env file correctly.
Sky020
November 19, 2020, 12:56pm
4
Have you sent the wrong link?
Because the boilerplate for these lessons looks like:
require('dotenv').config();
let Person;
const createAndSavePerson = (done) => {
done(null /*, data*/);
};
const createManyPeople = (arrayOfPeople, done) => {
done(null /*, data*/);
};
const findPeopleByName = (personName, done) => {
done(null /*, data*/);
};
const findOneByFood = (food, done) => {
done(null /*, data*/);
};
This file has been truncated. show original
1 Like
jcaber4
November 20, 2020, 2:04am
5
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