Search code examples
node.jsexpressnodemon

Nodemon not listening


I have added the nodemon dependency to the project. Made the main file as the server.js and have added the scripts as well on the package.json.

enter image description here

Server.js

enter image description here

While running the command npm run server - its giving the error below:

Error Screen

enter image description here


Solution

  • In general, I'd say please don't post code as images, but in this case, it reveals the solution...

    Your server code is server/server.js as far as the project root (where package.json is) is involved.

    When you run npm run style scripts, the working directory will be the project root (and you can see as much in the > file-upload@0.0.0 server ... line) – that is, change your server script to

    "scripts": {
      "server": "nodemon server/server.js"
    },
    

    and you should be golden.