Skip to content

Support for --trace-warnings option? #465

Closed

Description

@bitliner

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

How to pass an option --trace-warnings?

Activity

  1. blakeembrey commented on Nov 19, 2017

    @blakeembrey
    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.

  2. added a commit that references this issue on Dec 10, 2017
    df3c05b
  3. stelcheck commented on Dec 10, 2017

    @stelcheck
    Contributor

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

  4. added
    you can do this
    on Dec 14, 2017
  5. blakeembrey commented on Dec 14, 2017

    @blakeembrey
    Member

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

  6. stelcheck commented on Dec 15, 2017

    @stelcheck
    Contributor

    Done.

  7. kateile commented on Aug 23, 2019

    @kateile

    @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

  8. stelcheck commented on Aug 26, 2019

    @stelcheck
    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.

  9. Elyx0 commented on Jul 16, 2020

    @Elyx0

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

  10. Elyx0 commented on Jul 16, 2020

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

    For future reference, this worked

  11. LeonardoRick commented on Sep 30, 2020

    @LeonardoRick

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

  12. cspotcode commented on Sep 30, 2020

    @cspotcode
    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.

  13. Psychosynthesis commented on Nov 30, 2020

    @Psychosynthesis

    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?

  14. cspotcode commented on Nov 30, 2020

    @cspotcode
    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.

  15. LeanKhan commented on Jul 25, 2021

    @LeanKhan

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

    I use this and it works 🤔

  16. benallfree commented on Aug 11, 2021

    @benallfree

    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]
    
  17. LeanKhan commented on Aug 20, 2021

    @LeanKhan

    @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...

  18. aymantaybi commented on Sep 29, 2022

    @aymantaybi

    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.

  19. amanjha8100 commented on Oct 4, 2023

    @amanjha8100

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

  20. rafalfigura commented on May 5, 2025

    @rafalfigura

    I was able to achieve that with env variable:

    NODE_OPTIONS='--trace-warnings'
    
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

    enhancementyou can do this

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions