Skip to content

How to use --inspect-brk with NODE_OPTIONS #1007

Description

@ORESoftware

I am on Node.js versions 6+

I am trying to use NODE_OPTIONS

this is working for me:

node --inspect-brk foo.js

but this isn't

NODE_OPTIONS="--inspect-brk" node foo.js

with the latter I keep getting "address is already in use" errors

any ideas?

Activity

  1. gibfahn commented on Dec 4, 2017

    @gibfahn
    Member

    Does foo.js spawn another process? If so the child_process will also try to start a version of the inspector, and you'll get the address in use error. Command line options don't propagate to child processes by default, environment variables do.

    However I'm not able to use the inspector through NODE_OPTIONS in 6.12.0:

    ▶▶▶ nvm use 6                                                                                                                                                                                    ~/tmp 1s
    Now using node v6.12.0 (npm v3.10.10)
    ▶▶▶ NODE_OPTIONS=--inspect-brk node t.js                                                                                                                                                         ~/tmp 1s
    node: --inspect-brk is not allowed in NODE_OPTIONS

    is it working for you?

  2. ORESoftware commented on Dec 4, 2017

    @ORESoftware
    Author

    @gibfahn ahh good thinking. so actually I am using ts-node to transpile TypeScript to JS on the fly.

    so you can do:

    ts-node --inspect-brk foo.ts

    and that flag will be passed to the node executable by ts-node, and this one works!

    but if I do

    NODE_OPTIONS="--inspect-brk" ts-node foo.ts

    this one gets the

    address already in use

    error.

    so maybe ts-node is spawning a child process, as you say. I am going to cross-contaminate this thread to see if I can get @blakeembrey on the line.

    TypeStrong/ts-node#471

  3. changed the title [-]How to use inspect-brk with NODE_OPTIONS[/-] [+]How to use --inspect-brk with NODE_OPTIONS[/+] on Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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