Error while trying to run nodemon

Asked

Viewed 1,363 times

0

Good afternoon, I am having trouble trying to run nodemon on my terminal. It is presenting the following error message:

C:\Users\juare\Desktop\Curso OmniStack\aulas\backend> yarn dev  
yarn run v1.16.0  
$ nodemon src/index.js  
`nodemon` não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.  
error Command failed with exit code 1.
  • 1

    Looks like you don’t have the nodemon installed. It should be installed?

  • 1

    npm i -g nodemon

  • @Andersoncarloswoss and @Sorack he makes use of Yarn, I believe the yarn install would already solve. @Juarezsimone can add to doubt the contents of your package.json? I put an answer with some options (including npm).

1 answer

3

There are two ways for you to solve the problem. The first is you install the library nodemon through the command npm install -g nodemon.

You can also make the installation as a development dependency for the project (npm install nodemon --save-dev) and in the file scripts section package.json put the instruction down:

...
"scripts": {
...
    "dev": "nodemon src/index.js"
...
}
...

Note: the ... are to demonstrate that not only can but also that there must be contents of the archive before and after the instructions.

After installing the package and placing the above instruction in the package.json, just execute the command npm run dev. I would like to say that this second option, I like very much, because in executing the npm install the system will also already make the installation of all dependencies for the development of the project.

I noticed that you make use of the yarn it is possible that you already have these steps performed. Try running a yarn install and then run the command again.

  • Vlw!! thanks a lot for the tip, I managed to solve. :)

  • 1

    @Juarezsimone Please read how to accept an answer

  • THANK YOU! I could only make it work by following the tip of the above comment. It’s more like a bug in my case, because if I run "nodemon index.js" or "nodemon src/index.js" the terminal returns an error, but running "Yarn run dev" the nodemon works without problems. You’ll get it right.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.