Node Express Error: Cannot find module ‘serve-favicon’

This error means you don’t have the module ‘serve-favicon’ installed on your project, here is the full error:

Error: Cannot find module 'serve-favicon'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.Module._load (module.js:472:25)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\project\a2-notifications\app.js:3:15)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! notifications@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to in
stall?

Buf if you are getting this error the ‘serve-favicon’ is probably not the only module missing. My guess is that you forgot to install the dependencies before running your project with npm start. Try executing npm install first, this command will download all the dependencies for you, after that your problem should be solved.

Recommended for you

How to Execute a .jar File with Node.js Child Processes You probably have already come across situations where your application had to execute other applications or native commands from the OS. Node.js can easily do that by spawning child processes. To show you how to do that I'm going to give you an example of how to execute a .jar file with node. Fi...
Error: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-ext... If you are facing this error it's because your page is trying to load a local file using file:// or C:/ (you can see it in the URL on your browser). It happened to me one time, that's because I created a HTML page and simply double-clicked on it to open it on the browser, my page was using a JSON fi...
How to Set up a Database connection with ReactJS The short answer to this question is: You shouldn't use React to connect directly to your database. React is a front-end framework, it should only be responsible for the user interface. If you need a database connection, the right place for it is the back-end, that's also where you're going to fetch...
Nodejs Totorial: Creating and Using Events Nodejs makes it very easy for us to use events, and we're not limited to a collection of predefined events, it has a built-in module that allows us create and emit our own events. Let me show you how easy it is to use this module, first we have require the events module and create the event emitt...

One comment on “Node Express Error: Cannot find module ‘serve-favicon’

  1. Mohamed Zerzeri

    i tried ‘npm install’, but the problem is still persisting, i even tried ‘npm update –save’ & the problem is still there.

Leave a Reply

Your email address will not be published. Required fields are marked *

Obs: Use the tag <pre lang="LANGUAGE"> to include code blocks to your comment.
Example: <pre lang="javascript"> console.log('Test'); </pre>