# Solved: About syntax errors and good debugging practices

**URL:** https://discourse.nodered.org/t/solved-about-syntax-errors-and-good-debugging-practices/28497
**Category:** General
**Created:** [17 June 2020 21:17 UTC](https://discourse.nodered.org/t/solved-about-syntax-errors-and-good-debugging-practices/28497 "2020-06-17T21:17:27Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [18 June 2020 00:03 UTC](https://discourse.nodered.org/t/solved-about-syntax-errors-and-good-debugging-practices/28497/5 "2020-06-18T00:03:58Z")

</div>

A few articles have been written about debugging with Node-RED, I think there is one on my blog.

Most of the time, debugging involves simply copious amounts of logging statements. I tend to use console.log for temporary outputs - leaving the node-red log for things I probably want to leave in place longer-term.

I also tend to include some standard info about where in my node the output is coming from. Such as this simple example from uibuilder:

```auto
console.log('[uiblogin] Validation Errors: ', errors)

```

or this slightly more complex example:

```auto
console.log('[uibuilder:socket.on.control] Use Security _auth: ', msg._auth, `. Node ID: ${node.id}`)

```

For the occasional need that goes beyond that, I use VScode's debugging features by starting up Node-RED with a custom npm start script:

```auto
  "scripts": {
    "start": "pm2 start ecosystem.config.js",
    "start4": "nodemon --ext js,html node_modules/node-red/red.js --userDir ./data",
    "start2": "set DEBUG=express:* & nodemon node_modules/node-red/red.js --userDir ./data",
    "start3": "node node_modules/node-red/red.js --userDir ./data",
    "doctor": "clinic doctor -- node node_modules/node-red/red.js --userDir ./data",
    "bubble": "clinic bubbleprof -- node node_modules/node-red/red.js --userDir ./data",
    "inspect": "node --inspect node_modules/node-red/red.js --userDir ./data",

```

The last one attaches an inspector which can be used from within VScode. You need to remember to put a break statement in your code though otherwise the way that Node-RED starts up, you wont see much in the debugger.

Node.js isn't that easy to debug itself and the complexity of Node-RED as a platform makes that even harder because of the way everything links together. But once you have the hang of it, it isn't too hard.

---

_[View the full topic](https://discourse.nodered.org/t/solved-about-syntax-errors-and-good-debugging-practices/28497)._
