Introduction

N8N, an open-source automation platform, allows users to effortlessly integrate and automate workflows. One valuable aspect of N8N is the ability to extend its functionality through community nodes. While the default setup uses the public NPM registry, there may be scenarios where users prefer a self-hosted NPM registry for added control and security. In this article, we will explore why such a setup might be necessary and guide you through the process of installing N8N Community Nodes from a self-hosted NPM registry using Verdaccio.

Why Self-Hosted NPM Registry?

There are situations where utilizing a self-hosted NPM registry becomes crucial. A self-hosted NPM registry provides users with control over their package management, ensuring a reliable and secure environment for their workflows. It becomes particularly relevant in scenarios where organizations require a private registry to manage proprietary or sensitive packages. By utilizing a self-hosted NPM registry, users can efficiently manage access, monitor package versions, and maintain the integrity of their workflows. You can also test Community Nodes that you are developing prior to making them publicly available on registry.npmjs.org.

Setting Up Verdaccio

To kickstart the process of installing N8N Community Nodes from a self-hosted NPM registry, the first step involves setting up Verdaccio. Verdaccio is a lightweight NPM registry that can be easily deployed on your local machine. Using Docker, you can initiate Verdaccio with the following command:

docker run -it --rm --name verdaccio -v /tmp/storage:/verdaccio/storage -p 4873:4873 verdaccio/verdaccio

This command launches Verdaccio, making it accessible via http://localhost:5678. Now that your private NPM registry is up and running, let’s proceed to configure N8N to fetch packages from this registry.

Installing N8N Community Nodes

There are two main scenarios for installing Community Nodes from a private NPM registry: directly in the OS or within a Docker container or SaaS-hosted N8N instance.

Option 1: Installing N8N Community Nodes in an OS Environment

If you are running N8N directly in your operating system, follow these steps:

  1. Open your terminal and set the NPM registry by running the command:
npm config set registry http://localhost:5678/
  1. Restart your N8N instance to apply the changes.

Option 2: Installing N8N Community Nodes in a Docker Container or SaaS-hosted N8N

For users running N8N in a Docker container or using a SaaS-hosted solution, follow these steps:

  1. Create a new workflow in your N8N instance and add an “Execute Command” node to it.
  2. Enter following command in node configuration:
npm config set registry http://localhost:5678/
  1. Run the node to apply the changes.

Configure private npm registry from n8n workflow

By configuring your NPM registry to point to http://localhost:5678/, you ensure that whenever you install a community node into your N8N instance, it will fetch the necessary packages from your self-hosted registry.

Conclusion

Setting up a self-hosted NPM registry with Verdaccio and configuring N8N to use it provides users with enhanced control over their package management. Whether running N8N in an OS environment or within a Docker container, the steps outlined above allow for a seamless integration of community nodes from a private registry, ensuring a secure and efficient automation platform.