nodemon is not recognized as internal or external command code example

Example 1: 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. At line:1 char:1 + nodemon index

npm install -g nodemon --save

Example 2: nodemon is not recognized

//You need to install nodemon as globally. Use this command
npm install -g nodemon
//Now you can use nodemon it will work

Example 3: 'nodemon' is not recognized as an internal or external command, operable program or batch file.

Run: $ npm install -g nodemon

Run: $ npm install --save-dev nodemon

Change package.json file as:

"scripts": {
    "serve": "nodemon index.js"
}
Run: $ npm run serve