-
-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug/feature: ts-node should work with NODE_OPTIONS #471
Comments
See this issue for reference: nodejs/help#1007 |
I think the best option would be to wrap or convert https://github.com/TypeStrong/ts-node/blob/master/src/bin.ts into a bash/cmd script. |
@stelcheck I think the problem is that https://github.com/TypeStrong/ts-node/blob/master/src/bin.ts#L53 so what we need is that spawned child process to debug on a different port than the parent process. |
Why even spawn a port on the |
dude I am so confused this is ergonomic NODE_OPTIONS="--inspect-brk" ts-node foo.ts but it breaks... try it. are you suggesting something more ergonomic, or less? Sounds like the latter to me. Perhaps demo the code you are talking about. |
Apologies for the confusion. I am suggesting a way to patch And please don't call me dude. |
Actually, the simplest thing might just be to introduce a |
This will remap all `TS_NODE_` environment to `NODE_` environment variables for the child process being spawned. Fixes TypeStrong#465 TypeStrong#471
I preemptively created a PR implementing that behavior. @ORESoftware feel free to give it a spin and let me know if this would fix your current issue. |
@stelcheck yes I think that's a good idea - |
if you could make that a command line argument as well as an env variable, that'd be nice too, but probably not that important: ts-node foo.ts --ts-node-options="--inspect-brk --harmony" I really just need one or the other, but both would make me happy too |
For now, can you use |
@blakeembrey - in this case my node.js process is spawning children and I need to debug the children using Node.js exec flags, so it's not just about loading |
This will remap all `TS_NODE_` environment to `NODE_` environment variables for the child process being spawned. Fixes TypeStrong#471
#499 Would allow you to use NODE_OPTIONS off the bat instead of using TS_NODE_OPTIONS |
cool I am all for anything that werks |
Closing with #536 as I won't be supporting the subprocess behaviour anymore. |
This works:
ts-node --inspect-brk foo.ts # ❤️
but this doesn't
I think it's because
ts-node
starts a child process, and because of that, we get an "address already in use" error. See the Node.js help issue attached.Just try it for yourself and you will see the problem.
The text was updated successfully, but these errors were encountered: