【问题标题】:App crashed in nodemon应用程序在 nodemon 中崩溃
【发布时间】:2017-09-10 16:52:49
【问题描述】:

我正在尝试使用 Git Bash 一个 nodejs 应用程序在调试模式下运行。 我做了好几次,但最近几次都不行了。

当我运行命令时:

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 文件中的一个脚本,它看起来像这样:

"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 % 利用率一直看起来都很好。

【问题讨论】:

    标签: node.js bash npm git-bash nodemon


    【解决方案1】:

    它准确地说明了问题所在。

    Unable to open devtools socket: address already in use
    

    应用程序的前一个实例仍在运行。只需重新启动计算机或终止相关的正在运行的进程。

    新编辑:OwlyMoly

    在特定端口杀死进程:(在 Mac 中)

    如果您知道应用运行的端口,则检查该端口 ID 并终止进程。

    查看端口号:

    lsof -i :YourPort
    

    lsof -n -iTCP:YourPort | grep LISTEN
    

    然后从结果中获取 PID 并使用以下命令杀死该进程。

    使用 PID 杀死进程:

    kill -9 PID
    

    【讨论】:

      猜你喜欢
      • 2015-12-25
      • 2019-12-02
      • 2021-06-21
      • 2017-06-21
      • 2021-12-08
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      • 2021-11-27
      相关资源
      最近更新 更多