Minimal reproducible repo:
I am trying to setup debugger with vscode for a nodejs app. I am running the app with babel-node
. No matter what I try, the breakpoint shows unbound.
I am running the app with this mand
nodemon --exec './node_modules/.bin/babel-node --inspect=0.0.0.0 src/bin/www'
Dockerfile:
FROM node:12
WORKDIR /usr/src/app/home_automation_server
COPY package*.json ./
RUN yarn install
COPY . .
Compose config:
server:
image: home_automation_server
volumes:
- .:/usr/src/app/home_automation_server
working_dir: /usr/src/app/home_automation_server
ports:
- 3000:3000
- 9229:9229
depends_on:
- db
- redis
networks:
- servernet
env_file:
- ./server.env
- ./database.env
mand: ["sh", "entrypoint.sh", "run"]
tty: true
.babelrc:
{
"presets": [
[
"@babel/preset-env",{
"targets": {
"node": "current"
}
}
]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
["module-resolver", {
"root": ["./"],
"alias": {
"projectRoot": "./",
"src": "./src"
}
}]
],
"sourceMaps": "inline"
}
launch.json:
{
"type": "node",
"request": "attach",
"name": "Debug: HA dev server",
"port": 9229,
"restart": true,
"trace": true,
"address": "localhost",
"localRoot": "${workspaceFolder}/src/bin",
"remoteRoot": "/usr/src/app/home_automation_server/src/bin",
"protocol": "inspector",
"sourceMaps": true
}
When I connect the debugger it connects
If I use inspect-brk
the app stops at first line and when debugger connects I can step through.
But when I set a breakpoint it does not work and grays out. Says "Unbound breakpoint"
What am I doing wrong? I have been at this for a long time and tried almost everything I could find by searching through google.
Minimal reproducible repo: https://github./ShocKwav3/babel-node-basic
I am trying to setup debugger with vscode for a nodejs app. I am running the app with babel-node
. No matter what I try, the breakpoint shows unbound.
I am running the app with this mand
nodemon --exec './node_modules/.bin/babel-node --inspect=0.0.0.0 src/bin/www'
Dockerfile:
FROM node:12
WORKDIR /usr/src/app/home_automation_server
COPY package*.json ./
RUN yarn install
COPY . .
Compose config:
server:
image: home_automation_server
volumes:
- .:/usr/src/app/home_automation_server
working_dir: /usr/src/app/home_automation_server
ports:
- 3000:3000
- 9229:9229
depends_on:
- db
- redis
networks:
- servernet
env_file:
- ./server.env
- ./database.env
mand: ["sh", "entrypoint.sh", "run"]
tty: true
.babelrc:
{
"presets": [
[
"@babel/preset-env",{
"targets": {
"node": "current"
}
}
]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
["module-resolver", {
"root": ["./"],
"alias": {
"projectRoot": "./",
"src": "./src"
}
}]
],
"sourceMaps": "inline"
}
launch.json:
{
"type": "node",
"request": "attach",
"name": "Debug: HA dev server",
"port": 9229,
"restart": true,
"trace": true,
"address": "localhost",
"localRoot": "${workspaceFolder}/src/bin",
"remoteRoot": "/usr/src/app/home_automation_server/src/bin",
"protocol": "inspector",
"sourceMaps": true
}
When I connect the debugger it connects
If I use inspect-brk
the app stops at first line and when debugger connects I can step through.
But when I set a breakpoint it does not work and grays out. Says "Unbound breakpoint"
What am I doing wrong? I have been at this for a long time and tried almost everything I could find by searching through google.
- Appreciate its not quite the same issue. I had a problem unbound breakpoints in Angular using VSCode. There is some information that may be useful in this github issue. Note, you can collect a debug trace from VSCode following the suggestions in this ment (part of the same github issue) – 0909EM Commented Oct 7, 2020 at 22:40
- Posted the issue in vscode's github, It has a fix now on the nightly build. github./microsoft/vscode/issues/108418 – ShocKwav3_ Commented Oct 17, 2020 at 10:37
- 2 I feel your pain, setting up launch configs in VSCode is a black art, and it takes me hours or even days every time I need to do it. The Node.js website says all you need to do is create a new project and press F5, but this is total bull**** – bikeman868 Commented May 16, 2023 at 3:50
3 Answers
Reset to default 6I had a similar problem with unbound breakpoints. My issue was an incorrect field in my launch.json:
"localRoot": "${workspaceFolder}/server",
I had forgot to include the /server. My launch.json file was back one directory relative to the nodejs app I was trying to debug in my directory labelled /server.
I had a similar issue, the problem was with launch.json, I had in the property
"program": "app.ts"
, I changed to "program": "$ {file}"**
. I could only test the app.ts
. In the other files, the breakpoints were set to "unbound"
Here is my launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}",
"sourceMaps": true,
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
]
}
]
}
I have a few project.json
files in my quite large project. I added "sourceMap": true
to the "build":{ "options":{}}
section of the portion that I needed to debug. That worked.