egg icon indicating copy to clipboard operation
egg copied to clipboard

Starting inspector on 127.0.0.1:9229 failed

Open houseBetter opened this issue 6 years ago • 7 comments

What happens?

1、 在本地,我用egg搭了2个应用,都是通过npm init egg --type=simple创建的项目 2、2个应用都通过npm run debug进入debug, 但第二个应用报Starting inspector on 127.0.0.1:9229 failed: address already in use (第一个应用是可以进入debug的,第二个启动报上面的错)

> egg-bin debug --port 7002 --inpsect=9898
Starting inspector on 127.0.0.1:9229 failed: address already in use

Context

  • Node Version: v8.16.2
  • Egg Version: 2.27.0
  • Plugin Name:
  • Plugin Version:
  • Platform:

houseBetter avatar Aug 04 '20 14:08 houseBetter

报错信息写的很清楚了

atian25 avatar Aug 04 '20 14:08 atian25

--inspect-port 试下

atian25 avatar Aug 04 '20 14:08 atian25

@atian25 响应迅速啊,不过, 改报5800 already in use

> egg-bin debug --port 7002 --inspect-port=9090

Debugger listening on ws://127.0.0.1:9090/775dc060-ec6c-42c5-b043-fcb781d2d974
For help see https://nodejs.org/en/docs/inspector
[egg-ts-helper] create typings/app/controller/index.d.ts (6ms)
[egg-ts-helper] create typings/config/index.d.ts (38ms)
[egg-ts-helper] create typings/config/plugin.d.ts (6ms)
[egg-ts-helper] create typings/app/index.d.ts (4ms)
[egg-bin:lib-start-cluster] {"typescript":false,"declarations":true,"port":7002,"workers":1,"baseDir":"/xxx","framework":"/xxx/node_modules/egg"}
2020-08-04 23:48:05,629 INFO 88068 [master] node version v8.16.2
2020-08-04 23:48:05,631 INFO 88068 [master] egg version 2.27.0
Starting inspector on 127.0.0.1:5800 failed: address already in use

官网上说5800是agent 调试端口, 通过EGG_AGENT_DEBUG_PORT 可以自定义端口,但npm run debug还是报错,如下:

> EGG_AGENT_DEBUG_PORT=12345 egg-bin debug --port 7002 --inspect-port=9090

Debugger listening on ws://127.0.0.1:9090/e13e42c9-6245-4efa-91e7-d36fbefff849
For help see https://nodejs.org/en/docs/inspector
[egg-ts-helper] create typings/app/controller/index.d.ts (5ms)
[egg-ts-helper] create typings/config/index.d.ts (49ms)
[egg-ts-helper] create typings/config/plugin.d.ts (6ms)
[egg-ts-helper] create typings/app/index.d.ts (1ms)
[egg-bin:lib-start-cluster] {"typescript":false,"declarations":true,"port":7002,"workers":1,"baseDir":"/xxx","framework":"/xxx/node_modules/egg"}
2020-08-04 23:57:51,352 INFO 93155 [master] node version v8.16.2
2020-08-04 23:57:51,354 INFO 93155 [master] egg version 2.27.0
Debugger listening on ws://127.0.0.1:12345/6d92a035-28f2-4411-b451-a472b33f6b43
For help see https://nodejs.org/en/docs/inspector
2020-08-04 23:57:54,627 INFO 93155 [master] agent_worker#1:93198 started (3266ms)
Debugger listening on ws://127.0.0.1:9091/46fe7b93-b33e-4d3d-8db6-c31e530e36e1
For help see https://nodejs.org/en/docs/inspector
9091 opened
(node:93138) UnhandledPromiseRejectionWarning: Error: listen EADDRINUSE :::9999
    at Server.setupListenHandle [as _listen2] (net.js:1360:14)
    at listenInCluster (net.js:1401:12)
    at Server.listen (net.js:1485:7)
    at Promise (/xxx/node_modules/tcp-proxy.js/index.js:118:10)
    at new Promise (<anonymous>)
    at TCPProxy.createProxy (/xxx/node_modules/tcp-proxy.js/index.js:72:12)
    at end.then.then (/xxx/node_modules/inspector-proxy/index.js:37:20)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:93138) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:93138) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2020-08-04 23:57:57,688 INFO 93155 [master] egg started on http://127.0.0.1:7002 (6334ms)

大神,何解?

houseBetter avatar Aug 04 '20 16:08 houseBetter

https://github.com/eggjs/egg-bin/blob/master/lib/cmd/debug.js#L38

atian25 avatar Aug 05 '20 03:08 atian25

多谢 @atian25 已解决,自定义 proxy端口--proxy=8888,

houseBetter avatar Aug 05 '20 05:08 houseBetter

@atian25 @houseBetter 老哥 最后怎么解决的 我这还是提示Starting inspector on 127.0.0.1:5800 failed: address already in use

xDaWenXi avatar Feb 23 '21 03:02 xDaWenXi

@houseBetter @xDaWenXi 大佬解决了嘛,环境变量传不进去啊,还是5800端口被占用

zhaoqi-nb avatar Dec 31 '21 06:12 zhaoqi-nb