Search code examples
node.jsnodemon

nodemon --ignore not recognized


According to the documentation, ignoring the Data.json file requires this command to be executed:

nodemon --ignore Data.json

enter image description here

I tried exactly that and it didn't work. The console kust returned:

Usage: nodemon [nodemon options] [scripts.js] [args]

See "nodemon --help" for more.

Other commands i tried:

nodemon --ignore 'Data.json'
nodemon --ignore "Data.json"
nodemon --ignore '/Data.json'
nodemon --ignore /Data.json

Solution

  • You need to pass your Server.js to nodemon prior to the ignore

    nodemon Server.js --ignore 'Data.json'
    

    Alternatively you can create a nodemon.json file

    {
      "verbose": true,
      "ignore": ["Data.json"]
    }
    

    and then pass this as a commandline argument

    nodemon Server.js --config nodemon.json