Debugging a custom node

Hello, guys!

I am developing a custom node and testing it on a local n8n on Docker. After writing the code in the node repository, I compile it, then take the /dist folder and replace the previous similar folder in the /custom folder with it. Then I restart Docker, and only then can I test my node.

Is there an easier way to debug a node? For example, so that when I change the code in the node repository, I can immediately see the changes in the n8n environment?

@pavelaof Setup Docker Volumes for Live Updates

Map your custom node directory to the Docker container using volumes. This allows n8n to load changes without requiring a container rebuild.


version: '3.8'
services:
  n8n:
    image: n8nio/n8n:latest
    volumes:
      - ./custom_nodes:/home/node/.n8n/custom/node_modules/custom_nodes

Does this answer your question?

I would recommend simply running locally via pnpm in watch mode.

If you 100% need to use docker, then you will need to deal with restarting dockeron each change. This is not very pleasant or fast for development.

git clone https://github.com/n8n-io/n8n.git cd n8n pnpm install

Create your node in the main repo mkdir packages/nodes-base/nodes/YourNode

pnpm dev

Hope it helps, feel free to mark as Solution if it does.