应用程式在Nodemon中当机 [英] App crashed in nodemon
问题描述
我正在尝试使用Git Bash一个nodejs应用程序在调试模式下运行. 我做了几次,但是在最近的一次上,它不再起作用了.
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.
当我运行命令时:
npm run startwindows:inspect
它说:
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".
我可以提供的是startwindows:inspect
是package.json文件中的脚本,它看起来像这样:
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"
使用--watch
是什么意思?在调试中测试这是正常情况吗?我的CPU%利用率一直都很好.
What means by using --watch
? Is this a normal case when testing it in debug? My CPU % utilization looks fine all the time.
推荐答案
好吧,它确切地说明了问题所在.
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.
新修改:通过 OwlyMoly
杀死特定端口上的进程:(在Mac中)
如果您知道应用程序运行所在的端口,请检查该端口ID并终止该进程.
If you know the port where your app running at, then check for that port ID and kill the process.
要检查端口ID:
lsof -i :YourPort
或
lsof -n -iTCP:YourPort | grep LISTEN
然后从结果中获取PID并使用以下命令终止该进程.
Then get PID from the result and use the below command to kill that process.
使用PID终止进程:
kill -9 PID
这篇关于应用程式在Nodemon中当机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!