简体   繁体   中英

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.

VS Code 终端中显示的错误行

The best solution I could go about this is:

 npm install -D nodemon // install as a dev dependency

 npm start // run script start

Below are some solutions

  1. This is how you can install nodemon
npm install -g nodemon

after that you have to run this command: npm run dev here dev is (script) server name

  1. after that if you are facing error like " 'nodemon' is not recognized as an internal or external command, operable program or batch file. " Then after install nodemon globally write below command:
npm config get prefix

in output you will get PATH and then past this path in to the Environment Variables and it solved

Restart the terminal and run this command

nodemon run dev

I hope after that it will work properly:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM