Hot reload into custom node development

Describe the issue/error/question

I am developing a custom node (n8n-nodes-woovi - npm), but I am seeing that is very slow to see my changes into N8N of local, every change that I make, I need to run:

npm run build && npm link && npm link n8n-nodes-woovi && npx n8n start

So I am asking for a more easy way to develop custom nodes, without running this command into the terminal every time

Hey @edumaciel10,

It isn’t going to help but I don’t think you need npm link on every change just the once should do it. What I tend to do while making nodes is make them directly inside of n8n then once complete I move them to their own npm package and give it a quick test, This same approach might work for you as well.

Link is not needed everytime idd.

I create a new node with the nodestarter.
Change all the names and everything to get a basic node.
Build the node
use NPM link to link it to my local n8n instance.
Start n8n
Check everything is OK
after everything is ok simply develop the node further, building it every time you change something. And then restart n8n if something changed in the UI to apply those changes. No more linking needed at this point.

@edumaciel10 As Jon suggested, you don’t need to run npm link more than once.
regarding hot-reloading, you can run n8n with env variable N8N_DEV_RELOAD set to true, and run npm run dev in your project. That way every change in your source code is first compiled into your dist folder, and then n8n can pick up the re-built files from the dist folder.
This is a very recent feature, and not very well tested with community nodes. So, if you have any issues, or suggestions, please feel free to report them.

BTW, I noticed that installing this custom node was downloading over 500MB of node modules, so I’ve create a PR to fix that.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.