nodemon: Infinite loop when starting nodemon
Hi everyone.
I’m trying to create a simple REST api with Node, Express, Swig and MongoDB, but when I try to start my app, it runs in an infinte loop tha goes like this:
$ npm start
> apirest-myproject@0.0.0 start /home/jfuertes/repositories/projects/myproject
> nodemon ./bin/www
13 Feb 12:42:27 - [nodemon] v1.3.7
13 Feb 12:42:27 - [nodemon] to restart at any time, enter `rs`
13 Feb 12:42:27 - [nodemon] watching: *.*
13 Feb 12:42:27 - [nodemon] starting `nodemon ./bin/www ./bin/www`
13 Feb 12:42:28 - [nodemon] v1.3.7
13 Feb 12:42:28 - [nodemon] to restart at any time, enter `rs`
13 Feb 12:42:28 - [nodemon] watching: *.*
13 Feb 12:42:28 - [nodemon] starting `nodemon ./bin/www ./bin/www ./bin/www`
13 Feb 12:42:28 - [nodemon] v1.3.7
13 Feb 12:42:28 - [nodemon] to restart at any time, enter `rs`
13 Feb 12:42:28 - [nodemon] watching: *.*
13 Feb 12:42:28 - [nodemon] starting `nodemon ./bin/www ./bin/www ./bin/www ./bin/www`
And so on. Do you know what could be happening?
Here is my nodemon --dump
$ nodemon --dump
13 Feb 12:50:13 - [nodemon] v1.3.7
13 Feb 12:50:13 - [nodemon] to restart at any time, enter `rs`
13 Feb 12:50:13 - [nodemon] watching: *.*
--------------
node: v0.13.0-pre
nodemon: v1.3.7
command: node /usr/local/bin/nodemon --dump
cwd: /home/jfuertes/repositories/projects/myproject
OS: linux x64
--------------
{ run: false,
system:
{ cwd: '/home/jfuertes/repositories/projects/myproject',
useFind: false,
useWatch: true,
useWatchFile: false },
required: false,
dirs: [ '/home/jfuertes/repositories/projects/myproject' ],
timeout: 1000,
options:
{ dump: true,
ignore:
[ '.git',
'node_modules',
'bower_components',
'.sass-cache',
re: /\.git|node_modules|bower_components|\.sass\-cache/ ],
watch: [ '*.*', re: /.*\..*/ ],
restartable: 'rs',
execMap: { py: 'python', rb: 'ruby' },
stdin: true,
verbose: false,
stdout: true,
execOptions:
{ script: './bin/www',
exec: 'nodemon',
args: [],
scriptPosition: 0,
nodeArgs: undefined,
ext: 'js',
env: {},
execArgs: [] },
monitor:
[ '*.*',
'!.git',
'!/home/jfuertes/repositories/projects/myproject/node_modules/**/*',
'!bower_components',
'!.sass-cache' ] },
load: [Function],
reset: [Function: reset],
lastStarted: 0,
loaded: [],
command:
{ raw: { executable: 'nodemon', args: [ './bin/www' ] },
string: 'nodemon ./bin/www' },
offset: 0 }
--------------
Thank you so much in advance.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 52 (18 by maintainers)
My solution: add nodemonConfig in package.json file in order to stop infinite loop. In package.json:
"nodemonConfig": { "ext": "js", "ignore": ["*.test.ts", "db/*"], "delay": "2" }, "scripts": { "start": "nodemon" }getting this in 2017, I have used nodemon a couple times before, not a newb with this, cannot figure out why it keeps restarting! will report back if I figure it out.
A fairly common example of nodemon looping restarts is when the application creates a file during start-up that’s caught be nodemon watch filters, which triggers a restart, and then the entire process goes into a loop.
Run
nodemon --verboseand it will report what’s restarting the process and why (so you can explicitly ignore that file or pattern).@ORESoftware in my case, I noticed it’s tracking my .tmp/ directory and
npm-log. So, all I did was include a.nodemonignoreand all the files I don’t want to bother about.My two bits… Try updating nodemon. I was using v1.11 and upgrading to v1.18.3 fixed the issue.
@tonespy that worked for me as well