Skip to content

fix: Fix issue preventing community nodes re-installing when using a custom registry#26599

Open
Joffcom wants to merge 2 commits intomasterfrom
node-4553
Open

fix: Fix issue preventing community nodes re-installing when using a custom registry#26599
Joffcom wants to merge 2 commits intomasterfrom
node-4553

Conversation

@Joffcom
Copy link
Member

@Joffcom Joffcom commented Mar 5, 2026

Summary

When running n8n with N8N_REINSTALL_MISSING_PACKAGES=true and N8N_COMMUNITY_PACKAGES_REGISTRY set to a custom registry, community nodes are not reinstalled on upgrades because the license is not initialized until after community nodes are loaded.

This PR changes the startup order so the license is initialized before community node installation is attempted.

Test Plan

Setup

  1. Create a temporary home directory:
    mkdir -p /tmp/node-4553
  2. Install a released version of n8n:
    npm install -g n8n@beta

Reproduce the bug (baseline)

  1. Start n8n with the released version:
    N8N_USER_FOLDER=/tmp/node-4553 \
    N8N_ENCRYPTION_KEY=SomeEncryptionKey123 \
    N8N_REINSTALL_MISSING_PACKAGES=true \
    N8N_LOG_LEVEL=debug \
    N8N_LICENSE_ACTIVATION_KEY=<LICENSE_KEY> \
    N8N_COMMUNITY_PACKAGES_REGISTRY=https://registry.npmjs.org \
    n8n start
  2. Complete initial setup, install a community node, and publish a workflow.
  3. Stop n8n.
  4. Delete the nodes folder to simulate missing packages:
    rm -rf /tmp/node-4553/.n8n/nodes
  5. Restart n8n using the same command from step 3.
  6. Check the log output — confirm the community node fails to reinstall (license error).

Verify the fix

  1. Stop n8n. Manually reinstall the community node and publish the workflow again.
  2. Stop n8n and delete the nodes folder again:
    rm -rf /tmp/node-4553/.n8n/nodes
  3. Start n8n using this PR's build:
    N8N_USER_FOLDER=/tmp/node-4553 \
    N8N_ENCRYPTION_KEY=SomeEncryptionKey123 \
    N8N_REINSTALL_MISSING_PACKAGES=true \
    N8N_LOG_LEVEL=debug \
    N8N_LICENSE_ACTIVATION_KEY=<LICENSE_KEY> \
    N8N_COMMUNITY_PACKAGES_REGISTRY=https://registry.npmjs.org \
    pnpm start
  4. Check the log output — confirm the community node is reinstalled successfully with no license / install errors.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-4553/community-nodes-unavailable-after-instance-restart
https://linear.app/n8n/issue/NODE-4028
https://linear.app/n8n/issue/NODE-4013

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@Joffcom Joffcom marked this pull request as ready for review March 5, 2026 11:33
@Joffcom Joffcom requested a review from elsmr March 5, 2026 11:34
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Architecture diagram
sequenceDiagram
    participant CLI as CLI Command (Start/Worker)
    participant License as License Service
    participant Community as Community Packages Service
    participant Registry as NPM/Custom Registry
    
    Note over CLI,Registry: Startup Process (N8N_REINSTALL_MISSING_PACKAGES=true)

    CLI->>CLI: base-command: init()
    Note right of CLI: General setup (Config, DB, etc.)

    CLI->>License: CHANGED: initLicense()
    License-->>CLI: License status & features loaded

    alt License is Valid
        CLI->>CLI: NEW: initCommunityPackages()
        CLI->>Community: init()
        
        Community->>Community: Check license for custom registry support
        
        opt Packages missing locally
            Community->>Registry: Fetch package metadata/tarball
            Registry-->>Community: Package data
            Community->>Community: Install packages to .n8n/nodes
        end
        
        Community-->>CLI: Loading complete
    else License Invalid / Missing
        CLI->>CLI: NEW: initCommunityPackages()
        CLI->>Community: init()
        Note right of Community: Fails or restricts custom registry access
    end

    CLI->>CLI: Continue service startup (Auth, Workflow Engine, etc.)
Loading

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant