Install private nodes
You can build your own nodes and install them in your n8n instance without publishing them on npm. This is useful for nodes that you create for internal use only at your company.
Install your node in a Docker n8n instance
Extend the official n8n image to include your compiled private node. You don't need to build n8n from source or download its entrypoint script.
Before you start, build your node with the n8n node CLI. This example uses n8n 2.42.0. It covers a node that needs only the n8n-workflow runtime dependency. If your node imports other packages, you must also make those packages available in the container.
Run the build command from your node project:
npm run buildCheck that
dist/contains your compiled.node.jsfile and its assets.Create a
Dockerfilein your node project, next todist/:FROM n8nio/n8n:2.42.0@sha256:862c954d784885f0406b19d9ee8f6a2ec9f93e976e2a6580ad85dedd58463bb1 ENV N8N_CUSTOM_EXTENSIONS=/opt/n8n-custom ENV NODE_PATH=/usr/local/lib/node_modules/n8n/node_modules COPY --chown=node:node dist/ /opt/n8n-custom/ USER nodeN8N_CUSTOM_EXTENSIONStells n8n where to load your node. The directory is outside/home/node/.n8n, so the data volume doesn't hide the node files.NODE_PATHlets your node resolven8n-workflowfrom this n8n image. Retest this path and your node before changing the image version.The image runs as the
nodeuser.COPY --chown=node:nodegives that user ownership of the compiled files. Keep the files readable and their directories accessible to that user.Create a
.dockerignorefile next to theDockerfile:* !Dockerfile !dist/This limits the build context to the Dockerfile and compiled files. Don't copy your host's
node_modulesdirectory into the image.Build your image from the node project directory:
docker build --tag customizedn8n:2.42.0 .Start a test instance with a separate data volume:
docker run -d --name n8n-private-node \ -p 127.0.0.1:5682:5678 \ -v n8n-private-node-data:/home/node/.n8n \ customizedn8n:2.42.0The data directory must be writable by the
nodeuser. This example uses a Docker-managed volume.Open
http://127.0.0.1:5682and complete owner setup for the test instance.Create a workflow with a Manual Trigger node. Add your private node from the node panel. Connect the trigger to your node.
Select Execute workflow. Check that your node returns the expected output.
Save the workflow before you recreate the container. Use the same data volume and custom image when you recreate it. Confirm that the saved workflow still contains your node and returns the expected output.
Install your node in a global n8n instance
If you've installed n8n globally, make sure that you install your node inside n8n. n8n will find the module and load it automatically.
Related resources
Last updated
Was this helpful?