Skip to content

Latest commit

 

History

History
 
 

20171206-js-node-debug-visualstudiocode

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

HowTo JS – Node Debug in Visual Studio Code

alt text

Visual Studio Code has support for JavaScript and out-of-the-box Node.js debugging. Here’s how.

Steps

  • open project
  • install
  • start
  • stop
  • debug mode start
  • debug code
  • debug mode stop

Open project

Start VSC -> File -> Open Folder -> Select Folder

alt text

alt text

alt text

Install

View -> Integrated Terminal -> “npm install”

alt text

alt text

alt text

Start

Integrated Terminal -> “npm start”

Start Chrome -> type “localhost:3000”

alt text

alt text

alt text

Stop

Integrated Terminal -> Ctrl+C -> “Y”+Return

alt text

Debug Mode Start

Debug Icon -> Settings -> NodeJS -> launch.json -> Save -> Debug Start Icon

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/server.js"
        }
    ]
}

alt text

alt text

alt text

alt text

alt text

Debug Code

Explorer Icon -> server.js -> add breakpoitn by double-clicking on line 7

Open Browser -> refresh (F5)

Open VSC -> Hover on source vars & params -> press Debug Continue Icon (F5)

alt text

alt text

alt text

alt text

alt text

alt text

alt text

Debug Mode Stop

Debug Stop Icon

alt text

Source on GitHub

https://github.com/DamienFremont/blog/tree/master/20171206-js-node-debug-visualstudiocode https://github.com/DamienFremont/blog/tree/master/20171206-js-node-debug-visualstudiocode

References

https://code.visualstudio.com/docs/nodejs/nodejs-tutorial https://code.visualstudio.com/docs/nodejs/nodejs-tutorial

Origin

https://damienfremont.com/2017/12/06/howto-js-node-debug-visual-studio-code/