Skip to main content
Entirius
AI platform for e-commerce
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

N8N - update version

This guide explains how to update an existing n8n instance to the latest version. The procedure uses npm to update n8n globally while preserving all data, workflows, credentials, and configuration.

Prerequisites

Before you begin, ensure you have:

  • SSH access to the server running the n8n instance
  • Administrative privileges (sudo access)
  • Backup of database (recommended before any major update)

Access to n8n Instance

Step 1: Connect to KVM Host Server

First, connect to the server hosting the KVM virtual machines:

ssh vm-admin@your-kvm-host-server

Step 2: Find n8n VM IP Address

List all virtual machines and get the IP address of your n8n instance:

sudo virsh list --all
sudo virsh domifaddr vm-company-production-n8n

Example output:

Name                 MAC address          Protocol     Address
-------------------------------------------------------------------------------
vnet0                52:54:00:12:34:56    ipv4         192.168.122.100/24

Step 3: Connect to n8n VM

Connect to the n8n virtual machine using SSH:

Replace 192.168.122.100 with the actual IP address from Step 2.

Alternatively, if you have configured the hostname in /etc/hosts:

ssh webapp@vm-company-production-n8n

You are now connected to the n8n instance and ready to proceed with the update.


Updating Node.js (Optional)

If you want to update Node.js to the latest LTS version, do this before updating n8n:

Check current and available versions:

# Current Node.js version
node --version

# Latest available LTS version
nvm ls-remote --lts | tail -1

Important: N8n typically requires Node.js 18.x or 20.x (LTS versions).
Check compatibility at https://docs.n8n.io/hosting/installation/server-setups/

Update procedure:

  1. Stop n8n service:

    sudo systemctl stop n8n
    
  2. Check current n8n version (to reinstall the same version):

    n8n --version
    

    Note the version number (e.g., 1.20.0).

  3. Update Node.js via NVM:

    nvm install --lts
    nvm use --lts
    
  4. Reinstall n8n (same version, for compatibility with new Node.js):

    npm install -g n8n@<version>
    

    Replace <version> with the version from step 2 (e.g., [email protected]).

  5. Update Node.js permissions:

    NODE_PATH=$(which node)
    sudo setcap 'cap_net_bind_service=+ep' "$NODE_PATH"
    
  6. Start service:

    sudo systemctl start n8n
    

Update n8n Procedure

Note: All commands in this procedure assume you are logged in as the webapp user (as per Step 3 above). NVM is automatically loaded in your shell session.

Step 1: Stop the n8n Service

Stop the n8n service to ensure safe update:

sudo systemctl stop n8n
sudo systemctl status n8n

Step 2: Check Current Version

Before updating, check the currently installed version:

n8n --version

Step 3: Update n8n Package

Update n8n to the latest version using npm:

npm update -g n8n

This command will:

  • Update n8n to the latest available version
  • Update all dependencies
  • Preserve the existing installation in the NVM environment

Step 4: Verify New Version

Check that n8n has been updated successfully:

n8n --version

Compare with the version from Step 2 to confirm the update.


Step 5: Start n8n Service

Start the n8n service with the updated version:

sudo systemctl start n8n
sudo systemctl status n8n

Step 6: Verify Update

Check service logs for any errors or warnings:

sudo journalctl -u n8n -n 50 -f

Look for:

  • Successful database connection
  • Successful startup messages
  • The new version number in logs
  • No error messages

Access the n8n web interface and verify:

  • Application loads correctly
  • Existing workflows are present
  • Credentials are intact
  • You can execute test workflows

Troubleshooting

Service Fails to Start

If the service fails to start after update:

  1. Check logs for specific errors:

    sudo journalctl -u n8n -n 100
    
  2. Verify Node.js permissions:

    NODE_PATH=$(which node)
    sudo getcap "$NODE_PATH"
    
  3. Check configuration file is still valid:

    cat /home/webapp/.n8n/.env
    

Database Migration Issues

If there are database migration errors:

  1. Check database connection:

    sudo -u postgres psql -c "\l"
    
  2. Review migration logs in journalctl output

  3. Restore from backup if necessary (ensure you have a backup before updating)

Permission Errors

If you encounter permission errors:

  1. Verify file ownership:

    ls -la /home/webapp/.n8n/
    
  2. Fix ownership if needed:

    sudo chown -R webapp:webapp /home/webapp/.n8n
    

Rollback Procedure

If the update causes issues and you need to rollback to a previous version:

  1. Stop n8n service:

    sudo systemctl stop n8n
    
  2. Install specific version:

    npm install -g n8n@<version>
    

    Replace <version> with the previous version number (e.g., [email protected])

  3. Restore Node.js capabilities:

    NODE_PATH=$(which node)
    sudo setcap 'cap_net_bind_service=+ep' "$NODE_PATH"
    
  4. Start service:

    sudo systemctl start n8n
    

Summary

This procedure safely updates n8n by:

  • Stopping the n8n service
  • Updating the n8n package via npm
  • Restarting the service
  • Verifying successful update

The update preserves all data, workflows, credentials, and configuration. The process typically completes in 1-2 minutes depending on your server and network speed.

Note: If you need to update Node.js as well, use the “Updating Node.js (Optional)” section at the beginning of this guide before updating n8n.