DEV Community

Discussion on: Build a Todo App with Node.Js, ExpressJs, MongoDB and VueJs – Part 1

Collapse
 
ctuxboy profile image
Christophe Hollebeke • Edited

Hello,

It's my first steps with NodeJS. Trying this nice tutorial, but i have this error:

ubuntu@nodejs:~/todo-app$ node server.js
internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module './app/Config'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/ubuntu/todo-app/server.js:19:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:279:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)

How can i solve this?

Collapse
 
abiodunjames profile image
Samuel James • Edited

Hi Christopher,
From the debug information, I could see that Config.js could not be imported. Please note that file names are case sensitive on Unix machines. Could you please double check Config.js is in the right case? I look forward to hearing from you :)

Collapse
 
ctuxboy profile image
Christophe Hollebeke

Hi Samuel,
Thanks a lot for your helpful answer. Yes that was the problem. Shame on me :-/

Ok, after that start the server: '$node server.js' but shows an error:

(node:2977) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.

After searching the net, found a solution. I'm adding this line to server.js:
const dbconfig = { useNewUrlParser: true, };

And add the variable in this line:
mongoose.connect(config.DB, dbconfig)

Now it works :-)

I'm a webdesigner buildign WP websites, but i want to learn NodeJS. Having basic JS knowledge, so i'm an absolute NodeJS beginner.
Trying learning a lot with this useful and awesome examples.
And... sorry for my poor english.