How to fix the “‘nodemon’ is not recognized as an internal or external command, program or batch file.” error in Windows?

Sometimes, we want to fix the “’nodemon’ is not recognized as an internal or external command, program or batch file.” error in Windows.

In this article, we’ll look at how to fix the “’nodemon’ is not recognized as an internal or external command, program or batch file.” error in Windows.

How to fix the “’nodemon’ is not recognized as an internal or external command, program or batch file.” error in Windows?

To fix the “’nodemon’ is not recognized as an internal or external command, program or batch file.” error in Windows, we can install nodemon as a dev dependency in our Node.js project.

To do this, we go to our Node project folder and run

npm install --save-dev nodemon

Then in package.json we add

{
  //...
  "scripts": {
    "test": "echo "Error: no test specified" && exit 1",
    "nodemon": "./node_modules/.bin/nodemon"
  }
  //...
}

to add the nodemon script that runs nodemon.

Then we can run the nodemon script by running

npm run nodemon

Conclusion

To fix the “’nodemon’ is not recognized as an internal or external command, program or batch file.” error in Windows, we can install nodemon as a dev dependency in our Node.js project.