How To Debug Node JavaScript Code in Visual Studio 2022

I have a very simple single JavaScript file that I want to run with Node.Js and debug in Visual Studio 2022.

I can do this fine with Visual Studio Code. To run and debug in Visual Studio Code I:

  1. Open a new JavaScript Debug Terminal Terminal instance
  2. Navigate to the correct location of the script
  3. Run with node index.js -s 'some_input_parameter'

I cannot seem to replicate this behavior in Visual Studio 2022 although I’m guessing it is something simple I’m missing because it’s got to be possible.

So far I have tried executing a similar command on the Developer PowerShell terminal. This runs the code fine but it does not debug the code. i.e. It does not break on breakpoints.

Please help, I much prefer Visual Studio over Visual Studio Code!