Open Kamilm55 opened 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
thanks But do i have to connect my database? and must i add dotenv ? for just running
yes thats compulsory you need to connect to your DB and make the ENV file
I was getting the error MongooseError: The
uri
parameter toopenUri()
must be a string, got "undefined". Make sure the first parameter tomongoose.connect()
ormongoose.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??
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.
sorry, i didnt read that you change the url, but i think that parameter its not complete.
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!