To fix the ‘nodemon command is not recognized in terminal for node js server’ error, we can install nodemon locally or install it locally and add a script into package.json
to run the local version.
To install it locally, we can run:
npm install -g nodemon
with NPM or:
yarn global add nodemon
with Yarn.
And to add a local version, we run:
npm install nodemon
with NPM or:
yarn add nodemon
with Yarn.
Then we add:
"serve": "nodemon server.js"
into the 'scripts'
second of package.json
.
And then we run:
npm run serve
With Yarn, adding to the 'scripts'
section is optional, and we can just run:
yarn run nodemon server.js
If we did add the script to package.json
, we run:
yarn run serve
One reply on “How to Fix the ‘nodemon command is not recognized in terminal for node js server’ Error?”
Nice!thumbs up