Skip to content

debugger (ie. node inspect). watch(<variabe>) says it's not defined, but it is. Am I not using this correctly? #2946

@DavidTsGit

Description

@DavidTsGit
  • Node.js Version:
    v12.18.3

  • OS:
    macOS 10.15.6

  • Scope (install, code, runtime, meta, other?):
    ???

  • Module (and version) (if relevant):
    ???

New here, and not quite sure the answers to some of the above.

Stepping through my code with node inspect as documented here: https://nodejs.org/docs/latest-v12.x/api/debugger.html

One of the options is:
• watch(expr): Add expression to watch list

Ok, I'm stepping through my code. I'm in the middle of a function called by a constructor function, instantiating/creating an object in a class. There's a bunch of let <variable> = <value> statements. If I go into repl and ask it to tell me the values of those variables (eg. I have one variable di for argument's sake) it reports them correctly. But (outside of repl again) I do watch(di) and it says Uncaught ReferenceError: di is not defined.

I can't imaging this is a bug, or it would have been found and fixed by others long before I came along. Am I using this incorrectly? How do I add a variable or expression to the watch list without getting that not defined error?

I'd appreciate any help. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions