Editing the code of a node

Is it possible to edit the code of a node? If yes, where are these files stored?

Hi @bmeester

yes, all nodes have code you can edit (although any changes will be lost the next time you install or upgrade the node...).

Which node do you want to edit? Is it a core node or one you've installed on top of node-red?

If its one you've installed, then it will be under ~/.node-red/node_modules/<module-name>/

If its a core node, then it will be in the node_modules/@node-red/nodes/... alongside wherever Node-RED itself is installed.

ah great I want to change the code in a sensor I won't update after that then or make my own node perhaps?

Hi @bmeester - I'm not sure what question you are asking.

When you say you want to change the code in a sensor, what do you mean? How does that related to a node-red? What node did you want to edit?

Because everything in Node-RED is based on node.js packages, you can simply take your own fork of a node if you need to make some tweak to it, you can then install your own version. That gives you the added advantage that you will be able to track changes to the original over time to see whether you still need your fork or whether you need to update it.

Of course, if your proposed change might help others, it is the neighbourly thing to do to offer your code change back to the author so that they can decide whether to include it in the original. To help with that, it is best to raise an issue against the original explaining what you need so that the author has a chance to respond.