Nodemon: Nodemon stuck at [nodemon] restarting due to changes...

Created on 26 Mar 2019  Â·  53Comments  Â·  Source: remy/nodemon

  • nodemon -v: "^1.18.10"
  • node -v: v11.12.0
  • 'express -v':
  • Operating system/terminal environment: WIN10
  • Using Docker? What image: no
  • Command you ran: "nodemon ./bin/www"

Expected behaviour

express server should reload with
Listening on port 3300 MongoDB connection initiated....

Actual behaviour

$ npm start

> [email protected] start --hidden-location
> nodemon ./bin/www

[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./bin/www`
Listening on port 3300
MongoDB connection initiated....
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...

and stuck there

Steps to reproduce

I am just running npm start, which leads to "nodemon ./bin/www"


my package,json
{ "name": "server", "version": "0.0.0", "private": true, "scripts": { "start": "nodemon ./bin/www" }, "dependencies": { "amqplib": "^0.5.2", "async": "^2.6.1", "body-parser": "~1.18.2", "connect-mongo": "^2.0.1", "cookie-parser": "~1.4.3", "cors": "^2.8.4", "debug": "~2.6.9", "ejs": "~2.5.7", "express": "~4.15.5", "express-acl": "^2.0.4", "express-react-views": "^0.10.5", "express-session": "^1.15.6", "lodash": "^4.17.11", "mongoose": "^5.3.2", "morgan": "~1.9.0", "passport": "^0.4.0", "passport-google-oauth2": "^0.1.6", "react": "^16.5.2", "react-dom": "^16.5.2", "request": "^2.83.0", "serve-favicon": "~2.4.5", "socket.io": "^2.0.4" }, "devDependencies": { "nodemon": "^1.18.10" } }
Please let me know if you need any additional info.

stale

Most helpful comment

not stale.

All 53 comments

Can you run npm ls chokidar in the directory you have nodemon installed?

Oh, and if you could re-run nodemon with --verbose so we can see what's causing the restart that would also be useful for debugging.

--verbose

[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 11048 to restart
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node ./bin/www`
[nodemon] forking
[nodemon] child pid: 10036
[nodemon] watching 38 files
Listening on port 3300
MongoDB connection initiated....
[nodemon] files triggering change check: util\utils.js___jb_tmp___
[nodemon] matched rule: **\*.*
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: util\utils.js
[nodemon] matched rule: **\*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] util\utils.js

me too

One strange behavior I noticed yesterday in server that, when ever server is crashed due to some error and I change the code , in that case its restarting app normally. but it do not start app while I am changing code normally.

Occurring to me too. Here's my --verbose

> nodemon index.js -V

[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 37936 to restart
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
[nodemon] forking
[nodemon] child pid: 42196
[nodemon] watching 28 files
Server listening on: 3090
(node:42196) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
[nodemon] files triggering change check: middlewares\refreshToken.js
[nodemon] matched rule: **\*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] middlewares\refreshToken.js

[nodemon] files triggering change check: middlewares\refreshToken.js
[nodemon] matched rule: **\*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] middlewares\refreshToken.js

package.json:

{ "name": "server", "version": "1.0.0", "description": "", "main": "index.js", "engines": { "node": "8.9.1", "npm": "5.5.1" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "nodemon index.js -V" }, "author": "", "license": "ISC", "dependencies": { "axios": "^0.18.0", "bcrypt-nodejs": "0.0.3", "body-parser": "^1.18.3", "cors": "^2.8.5", "express": "^4.16.4", "geolib": "^2.0.24", "geolocation-utils": "^1.1.1", "jsonwebtoken": "^8.4.0", "mongoose": "^5.4.1", "morgan": "^1.9.1", "passport": "^0.4.0", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0" }, "devDependencies": { "nodemon": "^1.18.10" } }

However, I have noticed that nodemon only hangs on restarting until the code finishes executing. Then it restarts normally.

Some more info:

npm ls chokidar
[email protected] C:\Users\me\Documents\projectrepo
`-- [email protected]
  `-- [email protected]

Hope this info helps. I've swapped to supervisor for the time being until I can get nodemon to work again.

I have same problem on my windows 10

[nodemon] 1.18.11
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGUSR2 to 16028 to restart
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node --inspect ./bin/www.js`
[nodemon] spawning
[nodemon] child pid: 9612
[nodemon] watching 3 files
//after change something and save
[nodemon] files triggering change check: app.js
[nodemon] matched rule: **\*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] app.js

finally I found a solution, if you can't wait ,you can try supervisor as an alternative

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

not stale.

finally I found a solution, if you can't wait ,you can try supervisor as an alternative

Would you mind sharing? @ffaaaa

i have same problem on window 8.1
nodemon version = 1.19.0
node version = 10.15.1

E:\React\dlstockr\server>nodemon index --verbose
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 5200 to restart
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index index.js`
[nodemon] forking
[nodemon] child pid: 5380
[nodemon] watching 3 files
example app listening on port  8080
[nodemon] files triggering change check: index.js
[nodemon] matched rule: **\*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] index.js

[nodemon] files triggering change check: index.js
[nodemon] matched rule: **\*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] index.js

when I switch node from v10.15.3 to v8.16.0 this problem disappear!

so maybe something wrong node.js API change or bug!

As crazy as it might sounds, I fixed it just restarting my computer
(windows 10).

On Mon, May 13, 2019 at 11:41 PM Shu Pengfei notifications@github.com
wrote:

when I switch node from v10.15.3 to v8.16.0 this problem disappear!

so maybe something wrong node.js API change or bug!

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/remy/nodemon/issues/1544?email_source=notifications&email_token=ABLB7BF223Q7JDXZFQB6QD3PVJNIXA5CNFSM4HBMONWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVKNQTI#issuecomment-492099661,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLB7BA4N2A2B73JDEOSFFDPVJNIXANCNFSM4HBMONWA
.

I am also having the exact same problem, @ffaaaa @deveshsinghal22 did you get the solution to the problem?

@AgrawalAnsh22 nothing as of now from nodemon side.
Using supervisor for time being, looks good to me.

Also seem to be having issues on my end.


  • nodemon -v: 1.19.1
  • node -v: v10.16.0 & v8.16.0
  • macOS 10.14.5, iTerm2 3.2.9
  • No Docker
  • npx nodemon --verbose index.js

Expected behaviour

[nodemon] restarting due to changes...
[nodemon] starting `node index.js`

Serving!
Local: http://localhost:9080

Actual behaviour

backend $ npx nodemon --verbose index.js
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 38030 to restart
[nodemon] watching: *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
[nodemon] forking
[nodemon] child pid: 38032
[nodemon] watching 10 files

Serving!
Local: http://localhost:9080

[nodemon] files triggering change check: app/app.js
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] app/app.js

[nodemon] files triggering change check: app/middleware/authentication.js
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] app/middleware/authentication.js

backend $ npm ls chokidar
├─┬ [email protected]
│ └─┬ [email protected]
│   └── [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └── [email protected]  deduped

EDIT
Just tested it on Node v8.16.0 and seeing the same behavior.

EDIT_2
My temporary solution is to use the forever package.

npm install forever

# then, assuming index.js is your entry file
npx forever -w index.js 

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

not stale

I still have this issue. I am using Windows 10. As a workaround, I too, am using forever.
npx forever -w index.js

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

I still have this issue

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

issue is still there.

@remy Please re-open this issue

@bjm904 sure, with details on how to replicate consistently.

i´m having the same problem
[nodemon] restarting due to changes...

After re-install Windows 10.
I am still stuck at [nodemon] restarting due to changes...

node -v: v10.16.3
npm -v: 6.9.0
nodemon -v: 1.19.2

Not (Never so far) stale!

This problem only happens to me when I run nodemon from the built in terminal from Visual Studio code. If you are using VSC, try running nodemon using something like git Bash.

Stuck on restarting due to changes...
I have a small app server the sends plain text, when changing the text as an example, i get the "restarting due to changes..."but when I go into the browser and reload the page(multiple times, waiting for minutes just to be sure) it appears as the server has not been updated

By default nodemon works perfectly fine in my cousin's macbook. In my laptop running Windows 8.1, using VSCode 1.38.1. Using the cmd console. This is a small test that shows how replicate the error:

//app.js file
`const express = require('express')
const app = express()

app.get('/', function(req, res) {
res.send("Hello World, please help me :'(")
})

app.listen(3000)`

//package.json
{ "name": "test", "version": "1.0.0", "description": "", "main": "app.js", "scripts": { "start": "nodemon app", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "express": "^4.17.1", "nodemon": "^1.19.2" } }
running trough

npm run start

If you need more info to be able to help me, please let me know

Not stale ! Just in case xD
Same issue for me: Node v10.15.0

I added a --delay for example nodemon lib/index.js --delay 1 and that solved the issue.

Hey @remy issue is persistent for me also, what information would need when replicating?

Try adding --signal SIGKILL to your nodemon command.

@m5m1th It worked. I have a mac. But why did that work?

Same issue
Node: v10.16.0
nodemon: 1.19.4

I got the same issue on nodemon -w *.go --exec go run main.go

main.go

package main

import (
    "fmt"
    "net/http"
)

func main() {
    fmt.Println("Go Running!")

    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        fmt.Println(r.URL.Path, http.Dir("public"), 123)
        fmt.Fprintf(w, "Hello, %q", r.URL.Path)
    })

    http.ListenAndServe(":8080", nil)
}

same on windows 10 , node 10.18.0

I have the same issue with Ubuntu 16.04 LTS and node v12.14.1.
The problem only occurs, when logging with winston with the following code:

const app = express();
...
const PORT = process.env.PORT || 5000;
app.listen(PORT, function() {
        winston_logger.info(`Server listening on port ${PORT}`);
});

If I comment out the winston_logger.info(...); line, the problem does not occur.

I use the following config for the winston-logger:

// Options for each transport.
var options = {
        file: {
                level: "info",
                filename: `${appRoot}/logs/askme.log.json`,
                handleExceptions: true,
                json: true,
                maxsize: 5242880, // 5MB
                maxFiles: 5,
                colorize: false
        },
        console: {
                level: "debug",
                handleExceptions: true,
                json: false,
                colorize: true
        }
};

// Create logger.
const logger = winston.createLogger({
        transports: [
                new winston.transports.File(options.file),
                new winston.transports.Console(options.console)
        ],
        exitOnError: false
});

// Create stream object that is used by morgan.
logger.stream = {
        write: function(message, encoding) {
                logger.info(message);
        }
};

The stream is used by morgan:
app.use(morgan("combined", { stream: winston_logger.stream }));

Guys, there is a simple very simple fix to that, please go to environment variables, select edit, and add a path for node js which can be "C:\Program Files\nodejs\"

This solved my problem, this is for windows 10 not sure about oter os for similar issues

actually this is not working to

I have this issue

Windows 10
node v12.16.1
npm 6.14.4
nodemon: 2.0.4

Eu tenho esse problema

Nó do Windows 10 v12.16.1
npm 6.14.4
nodemon: 2.0.4

Estou com o mesmo problema.
Você conseguiu resolver?

Eu tenho esse problema
Nó do Windows 10 v12.16.1
npm 6.14.4
nodemon: 2.0.4

Estou com o mesmo problema.
Você conseguiu resolver?

To usando o node-dev que faz a mesma coisa
O nodemon não consegui resolver

Resolvi meu problema com a dica da elzasimoes, muito obrigado Elza.
Ela me recomendou utilizar o (node-dev) e funcionou.

I am having this issue too

Try adding --signal SIGKILL to your nodemon command.

Trying this solved my problem. So my command became nodemon --signal SIGKILL server.js

This works for me;

Delete these directories; C:/Users/{user}/AppData/Roaming/npm and C:/Users/{user}/AppData/Roaming/npm-cache and re-installed global npm modules.

Sheers!!

Formatting and reinstalling windows worked for me

Formatting and reinstalling windows worked for me

Changing to a new PC works for me, I tried my best to resolve it on my old PC but couldn't until I change to another PC.

Use the alternative package called supervisor, click https://www.npmjs.com/package/supervisor to read more about it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piton13 picture piton13  Â·  3Comments

olalonde picture olalonde  Â·  3Comments

Autre31415 picture Autre31415  Â·  4Comments

fabianMendez picture fabianMendez  Â·  4Comments

giacomorebonato picture giacomorebonato  Â·  5Comments