Debug Typescript Node apps in Visual Studio Code (Great for NestJS!)

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024

Комментарии • 67

  • @from-chimp-to-champ
    @from-chimp-to-champ Год назад +12

    Thank you dear Sir Robert! 4 minute video is better than tons of crappy VS documentation 🤦‍♂🤦‍♂🤦‍♂

    • @tsyf1
      @tsyf1 8 месяцев назад

      Omg i can't believe how useless are the docs on this. This video was awesome.

  • @Nockoutz1
    @Nockoutz1 5 месяцев назад +2

    After like 2 days of trying to make TS work , your tutorial did it.
    Thank you so so much, I honestly almost gave up, it was so frustrating.

    • @RDT
      @RDT  5 месяцев назад

      Glad it helped!

  • @orancanoren7269
    @orancanoren7269 3 года назад +10

    This was very helpful. There are a lot of scramble about this simple topic online and this was the most straightforward one.

    • @RDT
      @RDT  3 года назад

      Thanks for the feedback! Happy to hear it helped you

  • @Yogurt4655
    @Yogurt4655 4 месяца назад

    Exactly what I needed. Most other tutorials seem to be focused solely on debugging web pages. Thank you!

  • @ronniet906
    @ronniet906 7 месяцев назад

    Thanks Robert, after using npm ts-express to generate a default Express TypeScript project, this video helped get my Windows VSCode Debug environment up and running to debug the code. Much appreciated.

  • @SandroMunda
    @SandroMunda 2 года назад +2

    Just having the following launch.json works well on my Nestjs app. No need of additional NPM packages.
    {
    "version": "0.2.0",
    "configurations": [{
    "name": "Launch via NPM",
    "request": "launch",
    "runtimeArgs": [
    "run",
    "start"
    ],
    "runtimeExecutable": "npm",
    "skipFiles": [
    "/**"
    ],
    "console": "integratedTerminal",
    "type": "pwa-node"
    }]
    }

    • @RDT
      @RDT  2 года назад

      Thanks, good to know.

  • @lalo-the-coder
    @lalo-the-coder 4 месяца назад

    This is a very simple but powerful approach, thanks for the tip.

  • @ruslan762
    @ruslan762 6 дней назад

    Txs a lot ! Simple but helpful guidance.

  • @techiabhil5530
    @techiabhil5530 11 месяцев назад

    This is the only approach that worked for me, thanks a ton 🙏

  • @gokulambalavanan3592
    @gokulambalavanan3592 11 месяцев назад

    thanks for the clear and short video , saved me ton of time

  • @anonymerlurch4544
    @anonymerlurch4544 10 месяцев назад

    Exactly what I was looking for. Thank you!

  • @omalyh
    @omalyh 3 месяца назад

    ty very much. you saved my time

  • @vincentluc5822
    @vincentluc5822 2 года назад +1

    Thanks ! I solved the debug with break points in 5 minutes for NestJS. Before I visited a thousand of links, and it was not working.

    • @RDT
      @RDT  2 года назад

      You’re most welcome 🙏

  • @agled
    @agled 3 года назад +1

    Robert, you save me! Thank you!

  • @budiardjo6610
    @budiardjo6610 Год назад

    it works, don't know that we neet to use runtime argument.

  • @felegeghionitvillage9527
    @felegeghionitvillage9527 Год назад

    That is helpful, you saved me time. Thanks

  • @KnightDark1233
    @KnightDark1233 5 месяцев назад

    Thanks but wish you could just also paste the instructions & launch.json file in the description.

  • @sarafanmol
    @sarafanmol Год назад +1

    can you share your source code repo (git or something )... it is not working for me

  • @rafaelffernandes
    @rafaelffernandes 9 месяцев назад +1

    Muito bom, rápido e fácil de configurar.

    • @RDT
      @RDT  3 месяца назад

      Thanks

  • @hugoburton5222
    @hugoburton5222 Месяц назад

    Lifesaver

  • @nehamourya2524
    @nehamourya2524 7 месяцев назад

    Thank you sir

  • @pari-production2324
    @pari-production2324 4 месяца назад +1

    thx

  • @krisztianr217
    @krisztianr217 2 года назад +1

    Thanks! :)

  • @Feronom
    @Feronom Год назад

    very good, why others say we need sourceMaps: true in launch config?

  • @pradipspeaks9395
    @pradipspeaks9395 2 года назад +1

    Awesome 👍

  • @emanuelcabrera9190
    @emanuelcabrera9190 2 года назад

    thanks for this video, you saved my life :D

  • @lucashood5781
    @lucashood5781 Год назад

    This was very nice! But I can't get my simple project to work when I followed your steps. Here are my config files:
    launch.json:
    {
    "version": "0.2.0",
    "configurations": [
    {
    "type": "node",
    "request": "launch",
    "name": "Debug TypeScript",
    "skipFiles": [
    "/**"
    ],
    "program": "${file}",
    "cwd": "${workspaceFolder}",
    "runtimeArgs": [ "-r", "ts-node/register", "-r", "tsconfig-paths/register" ],
    "outFiles": [
    "${workspaceFolder}/**/*.js"
    ]
    }
    ]
    }
    tsconfig.json:
    {
    "ts-node": {
    "esm": true,
    "experimentalSpecifierResolution": "node"
    },
    "compilerOptions": {
    "esModuleInterop": true,
    "module": "ESNext",
    "target": "ESNext",
    "moduleResolution": "Node"
    }
    }
    But I always got:
    TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for my source .ts file.
    Do I need to prebuild .js and get the source map first? Could you please share a sample tsconfig.json as well?
    Thanks for your time!!

  • @jaroush
    @jaroush Год назад +1

    Hi, how can I support the channel, most of the amazon items are unavailable.

    • @RDT
      @RDT  Год назад

      Thank you so much Jaroslav - we have a Buy Coffee page at www.buymeacoffee.com/robertsdevtalk if you’d like to support us 🙏

  • @syamsuonfire
    @syamsuonfire Год назад +1

    Thank you very muchh to save my life bro~

    • @RDT
      @RDT  Год назад

      You are very welcome Syamsu, and thanks for your support of the channel 👍

  • @AKMAshrafuzzamanJitu
    @AKMAshrafuzzamanJitu 3 года назад +1

    Thanks for sharing

    • @RDT
      @RDT  3 года назад

      You bet!

  • @AliAliOxenFree
    @AliAliOxenFree Год назад

    this is a quality video. earned a sub!

    • @RDT
      @RDT  Год назад +1

      Thank you 🙏

  • @Usernamesareoutdated
    @Usernamesareoutdated 2 года назад +2

    This didn't work for me. Wish it did. Pressing Run seems to run without catching any breakpoints, and no variables are loaded. It's as if it's running another file, but I clearly specified my file. I'm on linux. Are you on Windows? I'm using linux filesystem paths, not windows.

    • @RDT
      @RDT  2 года назад

      Hi Nicole - Windows mainly yes, but it works OK on the Mac too, which has similar file system paths. Are you using absolute paths or ${workspaceFolder}?

    • @christophelombart
      @christophelombart Год назад

      I have exactly the same issue. Did you find a solution ? thanks

  • @jennygarcia9105
    @jennygarcia9105 3 года назад +1

    Thanks :)

  • @Dhan_Profile
    @Dhan_Profile 10 месяцев назад +1

    npm install --save-dev ts-node tsconfig-paths

  • @hkthktm
    @hkthktm 3 месяца назад

    using tsx for now. this solution doesn't working with me

  • @NguyenHung-hb3sb
    @NguyenHung-hb3sb Год назад

    thanks you very much

  • @aungmyooo9692
    @aungmyooo9692 4 месяца назад

    I got TypeError: Unknown file extension ".ts"

  • @CraigShearer
    @CraigShearer 3 года назад +1

    Thanks Robert - useful - I'm debugging a nest-js back-end. Is it possible to set up node debugging to allow changes to my back-end code to automatically re-compile and then be available for the next request? Sort-of like hot-reloading for a front-end app.

    • @RDT
      @RDT  3 года назад +2

      Thanks Craig, that’s a good question. I’ll have a look into it, there is another method that uses nodemon and the “attach to process” function in VS Code, but I found this unreliable as the debugger did not always attach properly. Maybe there is another way, I’ll experiment and maybe do an updated video

  • @adnanahmed316
    @adnanahmed316 2 года назад

    Thank you

  • @from-chimp-to-champ
    @from-chimp-to-champ Год назад

    Dear Robert, can I only ask you one question? Seems like it does not stop in breakpoints inside .ts files, but only stops on the breakpoints in .js files... JS code is obviously a little bit different after a compiler has changed the .ts file. What could I do?
    Thank you very much!

    • @from-chimp-to-champ
      @from-chimp-to-champ Год назад

      Got it. May be i shouldn't have run the "tsc -w main.ts" in a separate terminal. Now seems to work

  • @sajadtorkamani9399
    @sajadtorkamani9399 2 года назад

    Thanks a lot. This is going to be super useful 👍

  • @WildGuesser
    @WildGuesser 11 месяцев назад

    Holy fuck thanks a lot

  • @victorkimura1
    @victorkimura1 2 года назад

    Thank you, Robert. Great tutorial. Just wondering what theme are you using for your VSCode setup? God bless

    • @anoopsidhu3859
      @anoopsidhu3859 Год назад

      I think it's One Monokai theme by Joshua Azemoh

  • @aleksandrsolovyov5310
    @aleksandrsolovyov5310 3 года назад

    Hello, thanks, can you debug config for jest with example? I have problem with one, thanks so much

    • @RDT
      @RDT  3 года назад

      Hi Alexsandr, are you using Jest with Nest?

    • @aleksandrsolovyov5310
      @aleksandrsolovyov5310 3 года назад

      @@RDT Yes I try, but I still confuse, because one config just debug compiled code, another one not working, so i don't know how to debug jest typescript in nest

  • @Content-gx1fm
    @Content-gx1fm 11 месяцев назад

    Its easy to configure... 00:15

    • @RDT
      @RDT  10 месяцев назад

      Thanks for your comment

  • @ahmedma527
    @ahmedma527 3 года назад

    Can you please how to attach to a process instead of launching a new one ("request": "attach")? it is very helpful because with attaching I would not lose all my bookmarks also I do not have to reload the page and lose the app state. It worked perfectly in Visual Studio but (same concept) and that exists here in vs code as well but we need to figure out how to do that (attach). I tried my self and I checked the documentation and other source but did not work out. Waiting for your help, please. Thank you in advance.

    • @RDT
      @RDT  3 года назад

      Thanks for the question Ahmed, have you a link to the documentation you used? I'll take a look as that sounds like a useful thing to be able to do

    • @ahmedma527
      @ahmedma527 3 года назад

      @@RDT Thank you for your response. Here the documentation about attaching to a process (code.visualstudio.com/docs/editor/debugging). Appreciate your help.

  • @veteranconsultant
    @veteranconsultant 9 месяцев назад

    not working at all dude