Using chrome://inspect
I can access 0.0.0.0:56745
to do debugging,
But I find debugging in WebStorm a far better experience. I try to create a Node.js Remote Debug
configuration like this to see if WebStorm supports it:
There's no response to any breakpoints in the js files.
Can you tell me whether WebStorm supports debugging Docker node inside WebStorm (not via Chrome developer tool) in the latest 2017.2.5 version?
docker-compose.yml
version: '3'
services:
web:
build:
context: .
dockerfile: docker/DockerfileDev.df
image: web:dev
ports:
- "3000:3000"
- "0.0.0.0:56745:56745"
expose:
- "56745"
entrypoint: ["npm", "run","nodemon" ]
package.json:
"scripts": {
"nodemon": "./node_modules/nodemon/bin/nodemon.js --inspect=0.0.0.0:56745 --debug-brk index.js"
},
DockerfileDev.df
FROM node:8
# some other stuff
UPDATE
The Remote debugger shows it's connecting, but there's nothing in the console, and doesn't pause at breakpoints:
Node.js Remote run configuration can only be used when debugging with TCP-based Protocol (Node.js < 7.x).
To remotely debug application with Chrome Debugging Protocol (with --inspect
/ --inspect-brk
, Node.js 7+), you need using Chromium Remote run configuration
After spending days trying to figure out what the problem was, I found that I needed to set the remote debug host to: localhost
then, make sure to update the "default" machine in Virtual Box to forward port: 56745 (NAT)
This way, I figured, webstorm connects to the container debugger through your host machine. At least that's the way I got Nodejs v8 to work.
Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.