DEV Community

Discussion on: Uploading Files to MongoDB with GridFS and Multer Using NodeJS

Collapse
 
krishnay2000 profile image
Krishnaraj Yadav

Error: Cannot find module 'ejs '
Thanks alot. This is very helpful tutorial for me.I am new in this field. I am facing above error and have installed ejs by npm and following line by line your code.
I can upload files but can't retrieve it . After writing ejs code of retrieving files i am getting this error.I need your help.

Collapse
 
shubhambattoo profile image
Shubham Battoo

did you try installing ejs? it can be done using npm, you can run npm install ejs to install ejs

Collapse
 
krishnay2000 profile image
Krishnaraj Yadav

Yes I have done that already and even tried to install it globally.Actually, it just works fine if I pass only json data to index.ejs but error occurs only after typing the below code in index.ejs file:

Code link : dev-to-uploads.s3.amazonaws.com/i/...
Error link : dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
shubhambattoo profile image
Shubham Battoo

Can you share your GitHub repo, if you have one where you where trying it, i can maybe take a look for you 😀

Thread Thread
 
krishnay2000 profile image
Krishnaraj Yadav • Edited

Sure . Here it is
github.com/krishna-y2000/Uploading...
Server file of above code is in /routes/uploadFiles.js and /routes/upload.js.
Client file is in /views/HomePage.ejs and /views/upload.ejs

Thread Thread
 
krishnay2000 profile image
Krishnaraj Yadav

Update in error :
Please refer this image because the comment box is not responding properly .
dev-to-uploads.s3.amazonaws.com/i/...
You can mail me if you want to text me in detail.
Email : krishnay.75676@gmail.com
Thanks alot for your effort.