简体   繁体   中英

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

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM