This is how I debug a custom node in VS Code...
It works for me however since this is a dist version of node-red its difficult sometimes to debug client side issues. Other than that, debug stop points work in my node js files. For debuging my .html files, i enter debugger
into the function & open F12
(chrome debugger stops on the debugger
statement)
Setup...
- Install node-red as per instructions on nodered.org
- Run it one time so that
.node-red
folder is generated - Install own node...
-
cd c:\users\me\.node-red
(or linux equivelant) npm install c:\path_to_my_node
-
- Open VS code & "open folder" created on step 2 e.g.
c:\users\me\.node-red
(or linux equivelant) - Add following configuration to vscode
launch.json
(press CTRL+SHIFT+P then type launch.json)...
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Node-red",
"program": "c:\\path_to_npm_global\\node-red\\red.js",
"runtimeArgs": ["--preserve-symlinks", "--experimental-modules"],
"env": {
"NO_UPDATE_NOTIFIER": "1"
}
},
{
"type": "node",
"request": "launch",
"name": "Debug Current File",
"program": "${file}"
},
{ "type": "node", "request": "attach", "name": "Attach to Process", "processId": "${command:PickProcess}" }
]
}
- Select "Launch Node-red" from the debug drop down & press
F5
Hope this helps
Edit...
Some notes on my vs code setup
-
"NO_UPDATE_NOTIFIER": "1"
Without this, node-red takes over 3 minute startup (corporate proxy issue) -
--preserve-symlinks
becausenpm install c:\folder\my_node
creates a symlink & debug points wont stop on your .js code without it