Debugging - breakpoints not being hit

navmed
11
navmed
commented 2 years ago

I'm trying to debug this with Visual Studio Code. I have breakpoints set in the get methods in users.js, but none of the breakpoints are being hit. My launch.json looks like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceRoot}\\build\\main.js"
    }
  ]
}
idea
2
lcaprini
40
lcaprini
commented 2 years ago

Any updates?

I'm starting to use Nuxt.js with this template in Visual Studio Code, but I can not debug nodejs/express server with VS's breakpoints. This is my configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "npm run dev",
            "runtimeExecutable": "npm",
            "runtimeArgs": [
                "run-script",
                "dev-debug"
            ],
            "port": 9229,
            "timeout": 30000,
            "protocol": "inspector",
            "console": "integratedTerminal"
        }
    ]
}

with "dev-debug": "node --inspect node_modules/.bin/backpack dev" script.

The server start normally and I can view all node console message in integrated terminal, but no breakpoint works; VSCode says "Breakpoints set but not yet bound":

screen shot 2017-09-11 at 23 20 13

Thank you

0
aparolin
0
aparolin
commented a year ago

Any solutions to that?

0
tskittles
0
tskittles
commented a year ago

Did you figure this out?

0
aparolin
0
aparolin
commented a year ago

I was able to fix that by upgrading my node from v6 to v8

0
gijswijs
0
gijswijs
commented a year ago

I have this issue as well. Node v9.4.0, so upgrading won't work.

0
gamelaster
0
gamelaster
commented a year ago

This will not work, because backpack packing server scripts to one file.
For make debugging working, you must start server/index.js manually

0
gijswijs
0
gijswijs
commented a year ago

@gamelaster I'm not sure whether I understand you. I have webpack packing scripts into several files. One of them being server.js (and the breakpoints set there are being hit perfectly) but the other files are not.

0
marcosicp
0
marcosicp
commented a year ago

@gijswijs any news on this? you were able to solve this problem?

0
gijswijs
0
gijswijs
commented a year ago

@marcosicp No, I'm afraid not. I'm still at the point where server.js breakpoints are being hit, but everything else isn't.

0
alexcontanu
0
alexcontanu
commented 10 months ago

Try this:
"dev-debug": "node node_modules/.bin/backpack dev --inspect-brk"

0
moedong
0
moedong
commented 10 months ago

"node": "8.11.1"
"backpack-core": "^0.3.0"

package.json:

"dev-debug": "node node_modules/.bin/backpack dev --inspect-brk"

launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "npm run dev",
      "protocol": "inspector",
      // "program": "${workspaceRoot}/node_modules/nuxt/bin/nuxt",
      // "args": ["dev"],
      // "stopOnEntry": false,
      // "cwd": "${workspaceRoot}",
      // "sourceMaps": true,
      // "env": {
      //   "NODE_ENV": "development",
      //   "DEBUG": "nuxt:*,app"
      // },
      "runtimeExecutable": "npm",
      "runtimeArgs": ["run-script", "dev-debug"]
    }
  ]
}

According to the above configuration, the console shows the following:

C:\Program Files\nodejs\npm.cmd run-script dev-debug --inspect-brk=31094 
e:\node\nuxt-demo\node_modules\.bin\backpack:2

basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

          ^^^^^^^



SyntaxError: missing ) after argument list

    at createScript (vm.js:80:10)

    at Object.runInThisContext (vm.js:139:10)

    at Module._compile (module.js:616:28)

    at Object.Module._extensions..js (module.js:663:10)

    at Module.load (module.js:565:32)

    at tryModuleLoad (module.js:505:12)

    at Function.Module._load (module.js:497:3)

    at Function.Module.runMain (module.js:693:10)

    at startup (bootstrap_node.js:188:16)

    at bootstrap_node.js:609:3

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected]1.0.0 dev-debug: `node node_modules/.bin/backpack dev --inspect-brk`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected]1.0.0 dev-debug script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-06-20T10_08_29_436Z-debug.log
0
alexcontanu
0
alexcontanu
commented 10 months ago

My config is :
[email protected]
[email protected]
[email protected]

VS Code(launch.json):
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/node_modules/.bin/backpack",
"args": [
"dev", "--inspect-brk"
],
"env": {
"HOST": "localhost",
"PORT": "3000"
},
"port": 9229
}
]
}

0
realdanielbyrne
0
realdanielbyrne
commented 4 months ago

It is hard to believe that the nuxt community is growing as fast as it is, and nobody can debug. I'm running into the same or similar issue. A seemingly nonsensical error in a bash script when trying to launch node in --inspect. My suspicion is that the bash script at this location cannot be parsed correctly by windows cmd line, and so developer's on Macs are not seeing this error. Anyone in the community developing on a windows machine actually get the debugger in VScode to work with nuxt?

node --version
v10.15.0

node --inspect node_modules/.bin/nuxt

Debugger listening on ws://127.0.0.1:9229/166aa56c-51f5-48a7-bd60-45f026d5d2c2
For help, see: https://nodejs.org/en/docs/inspector
C:\dev\Rpmit\node_modules.bin\nuxt:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^

SyntaxError: missing ) after argument list
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module.compile (internal/modules/cjs/loader.js:657:28) at Object.Module.extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev-debug: node --inspect node_modules/.bin/nuxt
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev-debug script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

0
Miq3l
0
Miq3l
commented 4 months ago

It is hard to believe that the nuxt community is growing as fast as it is, and nobody can debug. I'm running into the same or similar issue. A seemingly nonsensical error in a bash script when trying to launch node in --inspect. My suspicion is that the bash script at this location cannot be parsed correctly by windows cmd line, and so developer's on Macs are not seeing this error. Anyone in the community developing on a windows machine actually get the debugger in VScode to work with nuxt?

node --version
v10.15.0

node --inspect node_modules/.bin/nuxt

Debugger listening on ws://127.0.0.1:9229/166aa56c-51f5-48a7-bd60-45f026d5d2c2
For help, see: https://nodejs.org/en/docs/inspector
C:\dev\Rpmit\node_modules.bin\nuxt:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^

SyntaxError: missing ) after argument list
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module.compile (internal/modules/cjs/loader.js:657:28) at Object.Module.extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev-debug: node --inspect node_modules/.bin/nuxt
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev-debug script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Same issue for me. Not possible to debug nuxt with VSC in Windows.

0
monico-moreno
0
monico-moreno
commented 14 days ago

It is hard to believe that the nuxt community is growing as fast as it is, and nobody can debug.

+100 on that!

I've been struggling with this for a week, as well.

Here's my last post on discord (where nuxt community is) where I mention a simple nuxt app where I am trying to show steps on how I am trying to debug/step-into my app code (which was created using create-nuxt-app)

๐Ÿคž

0
monico-moreno
0
monico-moreno
commented 13 days ago

Hello, everyone,

I and community found a solution ๐Ÿ™Œ I was thinking of posting a blog to share with the community, but here's the Discord convo for you immediately.

0
gangsthub
3
gangsthub
commented 12 days ago

Thank you, Monico. We should call this technique "the monico middleware"! ๐Ÿ˜‰

Attaching the repo for future reference: https://github.com/monico-moreno/nuxt-poc

0
Informations
Feature Request โ€ข Open
#c22 - Created 2 years ago