title: How to debug a Node-Red node with VS Code on Raspberry Pi?
body: <p>I'm developing a Node-Red node for i2c devices, but can not debug the code, because it does not stop at breaking points.<br />
  Both Node-Red (2.1.3) + Visual Studio Code (v1.61.1) are installed on the same Raspberry Pi OS (32 bit).</p>
  <p>I do not want to debug the whole NR system, nor node.js, just only <strong>that</strong> node (.js file) I'm working on inside VSCode and see the errors inside VSCode. <em>(Not inside a browser's debugger.)</em></p>
  <p>I've tried many many methods to adjust <code>launch.json</code> + <code>package.json</code>, added <code>debugging</code> lines into the .js file, etc.<br />
  I found two configs, which <strong>can start Node-red</strong> without errors, but it never stops anywhere during run.</p>
  <h1>package.json :</h1>
  <pre class="lang-json prettyprint-override"><code>
    &quot;scripts&quot;: {
      &quot;inspect&quot;: &quot;node --inspect /usr/lib/node_modules/node-red/red.js --userDir /home/pi/.node-red/node_modules/mcp-pfc-aio&quot;,
      &quot;start&quot;: &quot;node node_modules/node-red/red.js -v -u . -s settings.js&quot;,
      &quot;debug&quot;: &quot;node --nolazy --inspect-brk=9229 node_modules/node-red/red.js -v -u . -s settings.js&quot;
    },
  </code></pre>
  <h1>launch.json:</h1>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;version&quot;: &quot;0.2.0&quot;,
      &quot;configurations&quot;: [
          {
              &quot;type&quot;: &quot;node&quot;,
              &quot;name&quot;: &quot;Run Script: debug MCP3&quot;,
              &quot;program&quot;: &quot;/usr/lib/node_modules/node-red/red.js&quot;,
              &quot;mode&quot;: &quot;debug&quot;,
              &quot;cwd&quot;: &quot;/home/pi/.node-red/&quot;,
              &quot;skipFiles&quot;: [
                  &quot;&lt;node_internals&gt;/**&quot;
              ],
              //&quot;runtimeExecutable&quot;: &quot;npm&quot;,
              &quot;runtimeArgs&quot;: [&quot;--preserve-symlinks&quot;, &quot;--experimental-modules&quot;],
              &quot;request&quot;: &quot;launch&quot;
              //&quot;command&quot;: &quot;npm run debug&quot;,
          },
          {
              &quot;type&quot;: &quot;node&quot;,
              &quot;request&quot;: &quot;launch&quot;,
              &quot;mode&quot;: &quot;debug&quot;,
              &quot;name&quot;: &quot;Launch via NPM&quot;,
              &quot;runtimeExecutable&quot;: &quot;npm&quot;,
              &quot;runtimeArgs&quot;: [
                  &quot;--preserve-symlinks&quot;, &quot;--experimental-modules&quot;,
                  &quot;run-script&quot;,
                  &quot;inspect&quot;
              ],
              &quot;program&quot;: &quot;/usr/lib/node_modules/node-red/red.js&quot;,
              &quot;stopOnEntry&quot;: true,
  //            &quot;cwd&quot;: &quot;/home/pi/.node-red/&quot;,
  //            &quot;cwd&quot;: &quot;${workspaceRoot}&quot;,
              &quot;port&quot;: 9229,
              &quot;skipFiles&quot;: [
                &quot;&lt;node_internals&gt;/**&quot;
              ]
            }        
      ]
  }
  </code></pre>