Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ORESoftware opened this issue Dec 4, 2017 · 2 comments
Closed

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

ORESoftware opened this issue Dec 4, 2017 · 2 comments

Comments

@ORESoftware
Copy link

ORESoftware commented Dec 4, 2017

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?

@gibfahn
Copy link
Member

gibfahn commented Dec 4, 2017

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?

@ORESoftware
Copy link
Author

ORESoftware commented Dec 4, 2017

@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

@ORESoftware ORESoftware changed the title How to use inspect-brk with NODE_OPTIONS How to use --inspect-brk with NODE_OPTIONS Dec 27, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants