inventory-application icon indicating copy to clipboard operation
inventory-application copied to clipboard

throw new MongooseError

Open anuvivin opened this issue 3 years ago • 5 comments

I am new to this development. I am tried to run your application during that time i got below error. please help what is the issue and how to resolve it?

D:\inventory-application\node_modules\mongoose\lib\connection.js:579 [0] throw new MongooseError('The uri parameter to openUri() must be a ' + [0] ^ [0] 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. [0] at new MongooseError (D:\inventory-application\node_modules\mongoose\lib\error\mongooseError.js:10:11) [0] at NativeConnection.Connection.openUri (D:\inventory-application\node_modules\mongoose\lib\connection.js:579:11) [0] at Mongoose.connect (D:\inventory-application\node_modules\mongoose\lib\index.js:333:15) [0] at Object. (D:\inventory-application\server.js:35:10) [0] at Module._compile (internal/modules/cjs/loader.js:1137:30) [0] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) [0] at Module.load (internal/modules/cjs/loader.js:985:32) [0] at Function.Module._load (internal/modules/cjs/loader.js:878:14) [0] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) [0] at internal/main/run_main_module.js:17:47

anuvivin avatar Sep 08 '20 11:09 anuvivin

If I'm not mistaken, you must add the .env file that refers to the environment variables for the connection to the mongo database @anuvivin

karchx avatar Nov 27 '20 18:11 karchx

If I'm not mistaken, you must add the .env file that refers to the environment variables for the connection to the mongo database @anuvivin

Yeah you're right, and I'm glad you replied I just saw this issue now.

moelashmawy avatar Nov 27 '20 18:11 moelashmawy

Ok, for me it is my pleasure to answer, you could create a .env.example file to put all the necessary environment variables and when someone executes it locally put the values of their machine and thus not upload confidential data to github. Also if you allow me I can do a PR with that small change @moelashmawy

karchx avatar Nov 28 '20 17:11 karchx

Ok, for me it is my pleasure to answer, you could create a .env.example file to put all the necessary environment variables and when someone executes it locally put the values of their machine and thus not upload confidential data to github. Also if you allow me I can do a PR with that small change @moelashmawy

sure you can do a PR and also i will update the REAME with the env vars, thank you for your following up

moelashmawy avatar Dec 10 '20 08:12 moelashmawy

https://github.com/moelashmawy/inventory-application/pull/5 It's done, just accept it

karchx avatar Feb 16 '21 20:02 karchx