Search code examples
javascriptnode.jsnpmservernodemon

nodemon command not recognized by terminal


I am trying to automate the server reload using the nodemon. I have it installed locally and have the start set to

nodemon app.js using the code:

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

It ran fine for the first time, but after shutting down the system once and reopening my project, it does not seem to run properly anymore. Now it throws an error every time I use the command nodemon app.js.

The error line is:

nodemon : The term 'nodemon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

error line shown in VS Code terminal


Solution

  • The best solution I could go about this is:

     npm install -D nodemon // install as a dev dependency
    
     npm start // run script start