问题
I am trying to run in debug mode using Git Bash a nodejs application. I did it several times but on the recent ones it doesn't work anymore.
When I run the command:
npm run startwindows:inspect
it says:
14 Apr 15:10:59 - [nodemon] v1.4.1
14 Apr 15:10:59 - [nodemon] to restart at any time, enter `rs`
14 Apr 15:10:59 - [nodemon] ignoring: C:\XXX\.git/**/* C:\XXX\node_modules/**/* C:\XXX\bower_components/**/* .sass-cache
14 Apr 15:10:59 - [nodemon] watching: C:\XXX\server/**/* C:\XXX\config-local/**/*
14 Apr 15:10:59 - [nodemon] watching extensions: js,json,yaml
14 Apr 15:10:59 - [nodemon] starting `node --inspect --debug-brk energyreports.js`
14 Apr 15:10:59 - [nodemon] child pid: 6352
Unable to open devtools socket: address already in use
14 Apr 15:10:59 - [nodemon] app crashed - waiting for file changes before starting...
14 Apr 15:11:03 - [nodemon] watching 37,149 files
14 Apr 15:11:03 - [nodemon] watching 37,149 files - this might cause high cpu usage. To reduce use "--watch".
What can I provide more is that startwindows:inspect
is a script from the package.json file and it looks like this:
"startwindows:inspect":"set NODE_ENV=dus&& set NODE_CONFIG_DIR=./config-local/&& nodemon -V -w server -w config-local -e js,json,yaml --inspect --debug-brk| bunyan -o short"
What means by using --watch
? Is this a normal case when testing it in debug? My CPU % utilization looks fine all the time.
回答1:
Well it says exactly what the problem is.
Unable to open devtools socket: address already in use
Previous instance of the app is still running. Just restart your computer or kill related running processes.
New Edit: By OwlyMoly
Killing processes at a particular port: (In Mac)
If you know the port where your app running at, then check for that port ID and kill the process.
To check port id:
lsof -i :YourPort
or
lsof -n -iTCP:YourPort | grep LISTEN
Then get PID from the result and use the below command to kill that process.
To Kill process using PID:
kill -9 PID
来源:https://stackoverflow.com/questions/43411365/app-crashed-in-nodemon