MongoDB: Cannot find module '/home/runner/boilerplate-mongomongoose/index.js'

Tell us what’s happening:

i created a
MongoDB cluster at https://cloud.mongodb.com

added a MONGO_URI with
my URL as Value

mongodb+srv://<my_cluster_name>:@cluster0.enwxxip.mongodb.net/?retryWrites=true&w=majority

yes i replaced
<my_cluster_name>

changed source at the app.js
https://replit.com/@sl5net/boilerplate-mongomongoose
to:

mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });

and also tried

let mongoose = require('mongoose');
mongoose.connect(MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true });

was cloning the GitHub source to my repl and pressed run

and gut this error:

i got error:

Error: Cannot find module ‘/home/runner/boilerplate-project-urlshortener/index.js’

Your code so far

i tried to fix with:

means open

open .replit and run it

but same error.

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0

Challenge: MongoDB and Mongoose - Install and Set Up Mongoose

Link to the challenge:

https://replit.com/@sl5net/boilerplate-mongomongoose
its from 
https://github.com/freeCodeCamp/boilerplate-mongomongoose

thanks i changed.

now i get other error:

ReferenceError: MONGO_URI is not defined
at Object. (/home/runner/boilerplate-mongomongoose/myApp.js:4:18)

but i added it in the Secrets (without ’ or " )

its in the Secrets tab.
Screenshot_20230310_204501

ahhh yes. ists not referenzed. seems i forgot it

No you did not. I just looked at your replit for the Express challenges and you did it correctly in your GET /json route.

process.env.
thanks and sorry :pray:

one of my problems is that i often mix to many program-styles and languages in my mind. and i usually use jetbrains - tools :wink: its nearly like a auto-correction-tool

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