nodemon not found in npm

161,298

Solution 1

You can resolve this problem by adding nodemon to your package.json:

npm install nodemon --save-dev

The problem happens when nodemon does not exist in /node_modules/.bin.

Added --save-dev since it's required during development only.

Solution 2

Try to check installed global packages npm list -g --depth=0. If you will not find nodemon, - install it with flag -g or --save-dev. Don't install nodemon with flag --save, because nodemon uses only for development.

Solution 3

under your current project directory, run

npm install nodemon --save //save in package.json so that the following code cam find your nodemon

then under "scripts" in your package.json file, add "start": "nodemon app.js" (or whatever your entry point is)
so it looks like this:

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon app.js"
}

and then run

npm start

That avoids complicate PATH settings and it works on my mac
hope can help you ;)

Solution 4

Install nodemon globally using following command. It works on my computer, and I'm sure it will work on your system also.

npm install nodemon -g --save

Sometimes you should have the permission to install it globally. It can be easily done by using following command.

  1. In LINUX UBUNTU: sudo npm install nodemon -g --save

  2. In Fedora:

    a) su
    b)npm install nodemon -g --save

Solution 5

Try to install nodemon globally.

sudo npm install -g nodemon
Share:
161,298
akul
Author by

akul

backend developer west java

Updated on July 17, 2022

Comments

  • akul
    akul almost 2 years

    I have a problem: nodemon does not run off the npm script (e.g. npm start),
    but if nodemon is called on the command line outside the npm script, nodemon runs as normal.

    $ nodemon server.js
    14 Feb 22:59:51 - [nodemon] v1.3.7
    14 Feb 22:59:51 - [nodemon] to restart at any time, enter `rs`
    14 Feb 22:59:51 - [nodemon] watching: *.*
    14 Feb 22:59:51 - [nodemon] starting `node server.js`
    

    How it is called in npm script:

    package.json
    
    {
    ...
      "scripts": {
        "start": "nodemon server.js"
      }
    }
    

    When npm start script is run:

    $ npm start
    > [email protected] start /home/akul/Documents/aaa
    > nodemon server.js
    
    sh: 1: nodemon: not found
    
    npm ERR! Linux 3.13.0-45-generic
    npm ERR! argv "node" "/home/akul/npm-global/bin/npm" "start"
    npm ERR! node v0.12.0
    npm ERR! npm  v2.5.0
    npm ERR! code ELIFECYCLE
    npm ERR! [email protected] start: `nodemon server.js`
    npm ERR! Exit status 127
    npm ERR! 
    npm ERR! Failed at the [email protected] start script 'nodemon server.js'.
    npm ERR! This is most likely a problem with the aaa package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     nodemon server.js
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls aaa
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/akul/Documents/aaa/npm-debug.log
    

    I've been looking for a solution, but have not found one.

  • akul
    akul about 9 years
    npm WARN prefer global [email protected] should be installed with -g but now successfully, thank you so nodemon that in a global directory of unused :D
  • Bipon Biswas
    Bipon Biswas almost 7 years
    I also got same problem. now resolve for this command - npm install nodemon --save
  • Alban
    Alban over 6 years
    I some how lost the entry in my PATH. Not sure how, but your suggestion fixed it. Thanks
  • pulkit219
    pulkit219 over 6 years
    My pleasure!! Enjoy
  • Michael Nelles
    Michael Nelles over 5 years
    This also worked for me. Then to start - #nodemon ./path/to/startfile
  • grey87
    grey87 over 5 years
    Don't install nodemon with flag --save because nodemon uses only for development. Use -g or --save-dev
  • grey87
    grey87 over 5 years
    Don't install nodemon with flag --save because nodemon uses only for development. Use -g or --save-dev flag
  • Lord Elrond
    Lord Elrond over 5 years
    npm install -g nodemon
  • Mickael B.
    Mickael B. almost 4 years
    This has nothing to do with an update of node. nodemon installed locally goes in ./node_modules/.bin/nodemon. So you can npx to execute npm package binaries, or you can install nodemon globally (using -g) as stated in multiple other answers.
  • David Gilkeson
    David Gilkeson almost 4 years
    Thanks for your input, I had installed nodemon globally but still did not work for me. It was only until node.js was updated that it began working. Not sure how, but that's how I fixed it.
  • Because i hate myself
    Because i hate myself over 2 years
    path should be npm bin location This works export PATH=$PATH:~/npm/bin
  • Ashish Saini
    Ashish Saini about 2 years
    noice solution.