ed-roh / mern-social-media

Complete React MERN Full Stack Social Media App
992 stars 859 forks source link

How to run in my machine locally? #15

Open Kamilm55 opened 1 year ago

Kamilm55 commented 1 year ago

I upload files but i cannot add node modules When i write npm install error happens like this npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /Users/diyapatel/Desktop/KJSCE/mernsocial-media-master/package.json npm ERR!

Pukhraj85 commented 1 year ago

del package-lock.json by running rm package-lock.json after that npm install, then run npm install -g npx and just run the server-client (after adding "start": "node index.js", "dev": "nodemon index.js" to package.json "script" in server and also npm i morgan

Kamilm55 commented 1 year ago

thanks But do i have to connect my database? and must i add dotenv ? for just running

Pukhraj85 commented 1 year ago

yes thats compulsory you need to connect to your DB and make the ENV file

foxyfool commented 1 year ago

I was getting the error MongooseError: The uri parameter to openUri() must be a string, got "undefined". Make sure the first parameter to mongoose.connect() or mongoose.createConnection() is a string. did not connect but now I'm getting this error when I changed the first argument of mongoose.connect to string 'mongodb://localhost:3008/' MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:3008 did not connect. did you find a solutionn??

mjjr3 commented 1 year ago

that problem is because the mongoose connect function is trying to find the mongo url in .env file, so, you can create a new .env file or you can set in function the url, but its not recommended.

mjjr3 commented 1 year ago

sorry, i didnt read that you change the url, but i think that parameter its not complete.