Nodemon app crashed – Waiting for file changes before starting [5 Solutions]

In this post, I will give you 5 solutions, If you are getting a “nodemon app crashed – waiting for file changes before starting” error while trying to start your server with nodemon. This error generally occurs due to multiple node processes are running in the background or some syntax error in your code.

Below mentioned are the errors, you may encounter during the nodemon server start process –

  • Nodemon app crashed
  • Nodemon app crashed – Waiting for file changes before starting
  • App crashed waiting for file changes
  • App crashed nodemon
  • Nodemon app crashed waiting for file changes

Following are the reasons for the above-mentioned errors:-

  1. Lot of node processess are running in background
  2. Package.json and server.js are not in the same folder
  3. Forgot to source your .env files
  4. Changed the file at the same time you save nodemon debugger working
  5. In case of MongoDB, issue with cluster

Let’s deep dive and see the solutions to fix the nodemon app crash issue.

How to fixNodemon app crashed – Waiting for file changes before startingerror

I have jotted down 5 possible solutions for the nodemon app crashed issue for you. Try to follow all these solutions one by one, I am sure you will get your issue fixed.

Nodemon app crashed - Waiting for file changes before starting

Solution1 – Check and kill node processes to fix Nodemon app crashed issue

I am sharing options for Windows and Linux both. So based on your operating system, you can choose your steps.

For Linux –

  • Look for process id of node and make a note. This pid will be used as input in second command.
$ ps aux | grep -i node
  • Kill the process
$ sudo kill -9 [Process-ID]

or

$ sudo killall -9 node

Or you can also kill a specific port instead of killing all node processes

sudo lsof -i :3000 //replace 3000 with your port number
sudo kill -9 31363 // replace 31363 with your PID

For Windows

  • <Right click> on “Taskbar” and open Task manager
  • Check for the process Node.js: Server-side JavaScript in list
  • Select process and Click “End task” to kill node processes

It will fix the “Nodemon app crashed – Waiting for file changes before starting” error issue for sure.

Solution2 – Check for any JS syntax error in your code and run your server manually to debug error

Typing mistakes and JS syntax errors are the most common issues, which will stop your nodemon to start and will result in a nodemon app crashed error.

Once you validated that syntax is correct and there are no typing mistakes. Try running your server manually or use debug command to troubleshoot further.

  • Try Starting server manually
$ sudo node server.js

or

$ sudo node index.js
Run Nodemon server manually
  • Use debug option while running server
$ node --debug server.js

Solution3 – Validate Package.json and server.js are not in the same folder

To validate Package.json and server.js are not in the same folder. Open your Package.json file and check –

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
     "start": "nodemon Server.js"
 }

The below-mentioned image reflects the default entries in the package.json file after nodemon installation.

Package.json file default entries

Solution4 – Source your environment (.env) file

Don’t forget to source your environment variable file. Sometimes, if you forgot to source your “.env” file, that also results in the Nodemon app crashed – Waiting for file changes before startingerror. Check out this article for more information.

Solution5 – Validate MongoDB cluster is working fine

In the case of Mongo DB, make sure your cluster is working fine and restart your application. In addition, re-check for the mongo connection URL which was saved in default.json.

Summary

Above mentioned solutions fix approximately all nodemon crashed issues. If you follow all instructions carefully, I am confident, one of these solutions will fix your “Nodemon app crashed – Waiting for file changes before starting” error.

If you still get any issues, you can reply via comments and I will try to help you in the best possible way.

Happy Learning.

Dev

I'm Dev, your friendly neighbourhood Tech Savy. I spend my days with gadgets, servers, and the occasional laugh-inducing software mishap. Think of me as your tech-savvy, glitch-prone buddy. If you've got questions, feedback, or just need someone to blame when your Wi-Fi goes haywire, I'm your guy!