Search code examples
node.jsdockerdocker-composewebstorm

Does WebStorm Node.js Remote Debug work with Node.js v8 in Docker container?


Using chrome://inspect I can access 0.0.0.0:56745 to do debugging,

enter image description here

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:

enter image description here

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:

enter image description here


Solution

  • 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