Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using --inspect crashes on restart #139

Open
andrewgbliss opened this issue Apr 26, 2017 · 12 comments
Open

using --inspect crashes on restart #139

andrewgbliss opened this issue Apr 26, 2017 · 12 comments
Labels

Comments

@andrewgbliss
Copy link

andrewgbliss commented Apr 26, 2017

Here is my nodemon gulpfile. I am running the process in a docker container.

gulp.task('start:dev', done => {
  let started = false;
  nodemon({
    script: path.join(__dirname, 'index.js'),
    ext: 'js json',
    nodeArgs: ['--inspect=0.0.0.0:9229'],
    watch: path.join(__dirname, 'express'),
    legacyWatch: true,
    delay: 2000
  })
  .on('start', () => {
    // to avoid nodemon being started multiple times
    if (!started) {
      setTimeout(() => done(), 100);
      started = true;
    }
  });
});

Every time I save a file nodemon restarts as it normally would. But it also crashes with this error message:

Starting inspector on 0.0.0.0:9229 failed: address already in use app crashed - waiting for file changes before starting...

If I then save the file again it restarts it just fine. Is there a way to wait for the 9229 port to release before it starts again? It's really annoying to save a file twice just to get it to work.

If I change it to --debug it works, but that is deprecated. They want everyone to use --inspect.

@rluncasu
Copy link

rluncasu commented Jun 15, 2017

Same here, I'm starting it with

nodemon --inspect=0.0.0.0:9229 /app/server.js

inside a container based on

FROM node:8.1.0

with a shared volume on sources. Whenever I save a file on the sources volume, nodemon restarts but crashes with

[nodemon] restarting due to changes...
  nodemon bus emit: restart +13s
  nodemon bus.emit(exit) via SIGUSR2 +14ms
  nodemon bus emit: exit +0ms
[nodemon] starting `node --inspect=0.0.0.0:9229 /app/server.js`
  nodemon spawning node --inspect=0.0.0.0:9229 /app/server.js +1ms
  nodemon bus emit: start +7ms
  nodemon bus new listener: exit (1) +1ms
  nodemon start watch on: *.* +0ms
  nodemon:watch early exit on watch, still watching (1) +1ms
Starting inspector on 0.0.0.0:9229 failed: address already in use
[nodemon] app crashed - waiting for file changes before starting...

Re-saving the same file, again restarts but works ok this time.
I'm NOT using gulp-nodemon...just accidentally got here when searching for the issue.
Seems to be an issue with nodemon itself.

@megakoresh
Copy link

megakoresh commented Jul 28, 2017

Yeah same problem, using sails here + nodemon. Doing the following:
nodemon --inspect app.js
produces
error: Gulp :: Starting inspector on 127.0.0.1:9229 failed: address already in use
As the error shows up before any tasks are even attempted, I think this must be a deeper issue, potentiallu with gulp itself.

@yujiahaol68
Copy link

yujiahaol68 commented Aug 21, 2017

Just kill inspector and start inspector again
here is our team's solution in our package.json
The same in gulp task. You have to kill it first..

npm install --save-dev kill-port

in your package.json file. Kill it first before you run debug inspector on the same port.

"inspect": "kill-port --port 9229 && node --inspect=0.0.0.0:9229 build/startup.js",
"start_watch_inspect": "nodemon --delay 80ms --watch build/ build/startup.js --exec 'npm run inspect'",

@poonam-dev
Copy link

error

please solve this

@yujiahaol68
Copy link

Please try not to use nodemon to enable debug mode. Try to use node --inspect=...

@poonam-dev
Copy link

error1

now generate this error

@poonam-dev
Copy link

for put node --inspect=... at the place of nodemon --debug

@peeyushsrivastava
Copy link

peeyushsrivastava commented Apr 2, 2018

Try this approach may be it helps.

Actually it's getting started in background so you need to search for process which you have tried to run with command like nodemon --inspect app.js , so check if node server is running or not.

ps ax | grep node

then killall -9 node and then try this command and it will work.

@wzup
Copy link

wzup commented May 6, 2018

@yujiahaol68

kill-port: command not found

@yujiahaol68
Copy link

@wzup Please install kill-port as dev npm package first and then you can use it in your package.json script

@Robinfr
Copy link

Robinfr commented Jun 18, 2018

No solution for this? It's really annoying as you don't even get output anymore when it fails..

@SenP
Copy link

SenP commented Oct 4, 2018

This seems to be an irritating bug with no clear solution yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants