Skip to content
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

Support for --trace-warnings option? #465

Closed
bitliner opened this issue Nov 19, 2017 · 17 comments
Closed

Support for --trace-warnings option? #465

bitliner opened this issue Nov 19, 2017 · 17 comments
Labels
enhancement you can do this Good candidate for a pull request.

Comments

@bitliner
Copy link

I would need to run ts-node and print stack trace for unhandled promise exceptions.

How to pass an option --trace-warnings?

@blakeembrey
Copy link
Member

Feel free to submit a PR. It would need to be added to

const knownFlags = v8flags.concat([
. This code may be refactored before 4.0 though because of #459 and would also result in resolving this.

stelcheck added a commit to stelcheck/ts-node that referenced this issue Dec 10, 2017
This will remap all `TS_NODE_` environment to
`NODE_` environment variables for the child process
being spawned.

Fixes TypeStrong#465 TypeStrong#471
@stelcheck
Copy link
Contributor

@bitliner made a PR to add the flag, see #476

@blakeembrey blakeembrey added enhancement you can do this Good candidate for a pull request. labels Dec 14, 2017
@blakeembrey
Copy link
Member

blakeembrey commented Dec 14, 2017

@stelcheck If you can split out this issue with the other one, I can merge one before the other. Thanks!

@stelcheck
Copy link
Contributor

Done.

@kateile
Copy link

kateile commented Aug 23, 2019

@stelcheck how to use it?
I tried adding script in package.json as
"dev": "ts-node --trace-warnings src/server.tsx",
but i get error when run it

@stelcheck
Copy link
Contributor

Have a look at https://medium.com/the-node-js-collection/node-options-has-landed-in-8-x-5fba57af703d - this should allow you to define Node.JS flags and options through environment variables.

@Elyx0
Copy link

Elyx0 commented Jul 16, 2020

Doesn't work @stelcheck still getting the error on --trace-warnings

@Elyx0
Copy link

Elyx0 commented Jul 16, 2020

node  --trace-warnings -r ts-node/register -r tsconfig-paths/register ./src/index.ts

For future reference, this worked

@LeonardoRick
Copy link

should I be able to run ts-node --trace-warnings in 2020?

@cspotcode
Copy link
Collaborator

In 2020 specifically, you're supposed to do this: #465 (comment)

If you find yourself in 2019, you might need to do something else.

@Psychosynthesis
Copy link

In 2020 specifically, you're supposed to do this: #465 (comment)

If you find yourself in 2019, you might need to do something else.

It work, but looks awful. Why can't just add a parameter to the ts-node section in the config?

@cspotcode
Copy link
Collaborator

@Psychosynthesis This has been discussed many times before, but the short of it is: not possible because we don't spawn a subprocess. Doing so adds extra complexity for users and maintainers, and incurs a performance penalty.

@LeanKhan
Copy link

ts-node-dev --trace-warnings --respawn --transpileOnly ./src/server.ts

I use this and it works 🤔

@benallfree
Copy link

benallfree commented Aug 11, 2021

ts-node-dev --trace-warnings --respawn --transpileOnly ./src/server.ts

I use this and it works 🤔

@LeanKhan Doesn't work. When I run it, I get:

ts-node-dev: no script to run provided
Usage: ts-node-dev [options] script [arguments]

@LeanKhan
Copy link

LeanKhan commented Aug 20, 2021

@benallfree I was using a previous version of ts-node:
^1.0.0-pre.39. It stopped working when I updated to ^1.1.8 Now I have to find another way or rollback to that version...

@aymantaybi
Copy link

for anyone who wants to run ts-node and print stack trace for unhandled promise exceptions.

node --loader ts-node/esm --trace-warnings exemple/index.ts

make sure to have ts-node installed as a dev dependency.

@amanjha8100
Copy link

I still get error with this --trace-warnings flag. Has no one fixed it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement you can do this Good candidate for a pull request.
Projects
None yet
Development

No branches or pull requests