Reputation: 1787
My website (running on the express framework) suddenly started complaining that it needed a favicon. Upon adding a favicon.ico, it now gives me this error every time someone tries to view a page.
Error: Cannot find module 'ico'
at Function._resolveFilename (module.js:334:11)
...
Upvotes: 6
Views: 5899
Reputation: 4814
You just have to add a 'GET' handler for '/favico.ico' ;
app.get('/favico.ico' , function(req , res){/*code*/});
you could just add it there to silence the error or you could respond with an actual img uri .
Upvotes: 1
Reputation: 1787
Resolved; I have
app.all('/:action', function(req, res){
in my app.js, and it was trying to interpret the favicon.ico as a page.
Upvotes: 7
Reputation: 5025
some more information about the error would be helpful or some code examples.
just to make sure; you will have to add the path in which the .ico lies to a static route for express like so;
app.use("/mypathwhereicolies", express.static(__dirname+'/mypathwhereicolies'));
Upvotes: 0