Node.js: Cannot find module 'ico'

My site (running on an express framework) suddenly started complaining that it needed an icon. After adding favicon.ico now it gives me this error every time someone tries to view the page.

Error: Cannot find module 'ico' at Function._resolveFilename (module.js:334:11) ... 
+4
source share
3 answers

Decided; I have

 app.all('/:action', function(req, res){ 

in my app.js app, and it tried to interpret favicon.ico as a page.

+4
source

additional error information will be helpful or some code examples.

just to be sure; you will need to add the path in which .ico is the static route for the expression like this:

 app.use("/mypathwhereicolies", express.static(__dirname+'/mypathwhereicolies')); 
0
source

You just need to add the 'GET' handler to '/favico.ico';

 app.get('/favico.ico' , function(req , res){/*code*/}); 

you can just add it there to disable this error, or you can answer with the actual img uri.

0
source

Source: https://habr.com/ru/post/1393620/


All Articles