Default Node-red flow and pnpm

I trust you :slight_smile:

When you make changes to a file inside node_modules, the change takes effect, and it only affects your project until it gets stopped. This is why after 24 hours you don’t see the change anymore.

I strongly encourage you to continue using pnpm, but if you need to edit files inside node_modules, you have to make sure the file is patched, as you correctly discovered.

It should be very easy:

  1. copy somewhere in your project the files you want to patch, with the patch already applied. Let’s call them socketio-edited.js and chat-page-edited.js.

  2. Create a file named patch-node-red.sh with a content similar to this:

    #!/bin/bash
    
    cp socketio-edited.js node_modules/.registry.npmjs.org/node-red-contrib-socketio/1.0.5/node_modules/node-red-contrib-socketio/socketio.js
    
    # probably same for chat-page-edited.js, I don't know if you need this too
    
  3. in your package.json, add a "prestart" field:

"prestart": "bash ./patch-node-red.js"

if something is not clear, feel free to share the project name with me so I can take a look and fix it for you :slight_smile:

1 Like