Phpstorm attach to nodejs/chrome not connecting

Hi all,

I have this setup:

PhpStorm 2021.3.2

One nodejs 16.4.0 service inside a docker container, that exposes node inspect port

- "9300:9300" # node inspector port when running in debug mode

 

 

I am using typescript + ts+node + nodemon to provide one `debug` script like this in package.json

"debug": "nodemon --config nodemon.debug.json",

and the content of nodemon.debug.json is

{
"watch": ["src"],
"exec": "node --inspect-brk=0.0.0.0:9300 --require ts-node/register --require tsconfig-paths/register src/index.ts",
"ext": "js,ts"
}

 

running yarn debug inside the docker container works fine and gives expected message:

[nodemon] starting `node --inspect-brk=0.0.0.0:9300 --require ts-node/register --require tsconfig-paths/register src/index.ts`
Debugger listening on ws://0.0.0.0:9300/c93b91ad-787b-41e0-b945-57556b68ee00
For help, see: https://nodejs.org/en/docs/inspector

 

 

The problem is that when I want to connect from phpstorm to this listening node inspect it fails with message

`Cannot connect to localhost:9300`

 

My config:

 

 

Please any help here.

0
2 comments

Works fine for me using similar setup. What is a result of opening http://localhost:9300/json in browser? Also, what is the output of docker container ls command?

0

Hi, I am closing this issue because is resolved by itself after restarting mac.

 

Not sure what was the underlying reason, maybe docker did not bind container port 9300 to localhost or something else, but after restart now works.

 

Thank you for the reply

0

Please sign in to leave a comment.