MongoDB and Mongoose - Install and Set Up Mongoose

Error: Cannot find module ‘/home/runner/boilerplate-mongomongoose-1/index.js’

Getting the above error. Not able to proceed further.

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

Challenge: MongoDB and Mongoose - Install and Set Up Mongoose

Link to the challenge:

https://replit.com/@KhyatiKhaitan/boilerplate-mongomongoose-1#myApp.js

Your link to the challenge isn’t showing. Also, could you give us a link to your full code please?

I am copying the link but its not showing here.

You can always post a link by changing text into a link using the link icon:
This is an example.

Or use the </> icon (or CTRL+e) and paste the link where indicated:

example.com

</boilerplate-mongomongoose (1) - Replit>

Did you click the “Done” button at the start when you opened the boilerplate?

Select Use run command and click the Done button.

If not reopen a new boilerplate and do that.

Thanks! It worked but now both my test cases are failing. Even though mongoose dependency has already been added in my package.json file, it is not passing atleast that case
Link to my code:

</boilerplate-mongomongoose (2) - Replit>

</boilerplate-mongomongoose (2) - Replit>

mongoose=require("mongoose");
mongoose.connect(process.env.MONGO_URI)
require('dotenv').config();
  1. You need to require dotenv before you try to use an environment variable, so I’d put that line of code before the others.
  2. You should declare a variable here with const.
  3. You didn’t include the options set out in the challenge description, without which your URI will not be correctly parsed.
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });

Thank you so much. All of your suggestions worked and I completed the level.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.