Home > other >  nodemon app crashed - waiting for file changes before starting... HOW TO MAKE IT RESTART ANYWAY?
nodemon app crashed - waiting for file changes before starting... HOW TO MAKE IT RESTART ANYWAY?

Time:03-23

From time to time it does happen, but restarting the node bypass this. I really dont have how to debug and see the actual error and the site needs to be online anyway.

I wish to know a way to restart the server whet this error happens, without having to change a file or anything like that.

I know this is a way around, etc etc... but that's what I need to do now...

ERROR:

[nodemon] app crashed - waiting for file changes before starting...

PACKAGE.json

 "scripts": {
            "test": "echo \"Error: no test specified\" && exit 1",
            "start": "node app.js",
            "server": "nodemon app --ignore './client/'",
            "client": "npm start --prefix client",
            "dev": "concurrently \"npm run server\" \"npm run client\"",
            "build": "concurrently \"npm run server\" \"npm run client\""
        },

starting using node server.

CodePudding user response:

This occurred because the process was exited in a non-graceful way. If you want auto-restart after crashing, that's not the purpose of nodemon.

I would recommend pm2

CodePudding user response:

You could try using forever as advised in the nodemon FAQ.

forever -c "nodemon --exitcrash" app.js

This way if the script crashes, forever restarts the script, and if there are file changes, nodemon restarts your script.

  • Related