Last modified: Jun 24, 2025 By Alexander Williams

Fix Error: Cannot find module 'nodemon'

If you see the error Cannot find module 'nodemon', don't worry. This is a common issue in Node.js. It means your project can't locate the nodemon package.

Nodemon is a tool that automatically restarts your Node.js app when file changes are detected. It's popular for development.

Why does this error occur?

The error happens when Node.js can't find the nodemon module in your project. This usually occurs because:

  • Nodemon isn't installed
  • It's installed in the wrong place
  • There's a path issue

Solution 1: Install nodemon globally

The simplest fix is to install nodemon globally. This makes it available system-wide. Run this command:


npm install -g nodemon

After installation, verify it works:


nodemon --version

You should see the version number. If not, check our guide on Fix Node.js Error: Cannot find module.

Solution 2: Install nodemon locally

For project-specific use, install nodemon as a dev dependency:


npm install nodemon --save-dev

Then add a script to your package.json:


"scripts": {
  "start": "nodemon app.js"
}

Run it with:


npm start

Solution 3: Check your PATH

If nodemon is installed but not found, check your PATH. Global modules should be in your system path. Run:


npm config get prefix

Ensure this path is in your system's PATH variable. Similar issues can occur with other modules like Express or Mongoose.

Solution 4: Reinstall node modules

Sometimes node_modules gets corrupted. Delete it and reinstall:


rm -rf node_modules
npm install

Solution 5: Use npx

If you don't want to install nodemon, use npx:


npx nodemon app.js

This runs nodemon without permanent installation.

Common mistakes to avoid

1. Forgetting to save the package (use --save or --save-dev)

2. Installing in the wrong directory

3. Not having proper permissions

Conclusion

The Cannot find module 'nodemon' error is easy to fix. Most times, installing nodemon globally or locally solves it. If you face similar issues with other modules like dotenv, the solutions are similar.

Always check your installation and paths. Happy coding with nodemon!