Cannot find module 'date Format'


I have a project using nodejs.
I want to format the date using dateformat.
when I try on local it works, but when I upload it to the server, dateformat is unreadable (cannot find module ‘date format’)

enter image description here

this is my code

var date = new Date();
    var dateFormat = require('dateFormat');
    var periode = dateFormat(date, "yyyy-mm");

Any suggestions?


I guess you haven’t added the module to the project, you can go to the project directory and run the below command or add this module globally

> npm install dateFormat

Answered By – user3937422

Answer Checked By – Terry (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.