Home > Mobile >  can not run js file with nodemon
can not run js file with nodemon

Time:03-05

I install nodemon from npm in project but cant run js file with 'nodemon run start' and facing this error: 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.

CodePudding user response:

You need to install nodemon globally using the -g option.

npm install -g nodemon

This will add nodemon to your PATH environment variable so that your terminal knows where the executable file for nodemon is.

Otherwise your terminal doesn't know which executable you're trying to run.

Your second option is to run it through npx.

Use the following:

npx nodemon {filename}

npm will handle locating and running the executable for you. The npx command is installed on your computer by default when you install npm.

CodePudding user response:

You will need to install nodemon if you haven't already

for dev environment run $ npm install --save-dev

to install nodemon globally run

npm install -g nodemon

to run your app/server use

nodemon app 

If the name of your entry file is not app use its name in the command

nodemon {filename}
  • Related