Useful tools

Updating npm dependencies

Good explanation here.

Node Js and WSL

Debugging node in Visual Studio

attaching directly via VS Code terminal

node --inspect program.js

where program.js is your entry point - in one project I worked for it was server.js (didn't actually need the .js - could just put server).

  • Use Cmd + Shift + P to bring up the Visual studio code command palette and type in "toggle auto attach". If you're already debugging, you can turn auto attach on and off via the orange status bar at the bottom.

More here

Attach to node process

The Attach to Node Process action opens a Quick Pick menu that lists all potential processes that are available to the Node.js debugger. Access it with Cmd + Shift + P to bring up the Visual studio code command palette and type in "Attach to Node Process".

Via npm

If you already have an npm command setup - eg in this example a server command in the scripts section of package.json, then the config below would go in launch.json (more here).

Whenever you add a new config to launch.json, you get a new item in the dropdown top left next to the green Play / Debug button.

,
        {
          "name": "Launch via npm",
          "type": "node",
          "request": "launch",
          "cwd": "${workspaceFolder}",
          "runtimeExecutable": "npm",
          "runtimeArgs": ["run-script", "server"],
          "port": 9229
        }