/n8n-tutorials

How to update n8n to the latest version?

Learn how to update n8n to the latest version with step-by-step instructions for Docker, npm, Debian/Ubuntu, Kubernetes, and more. Backup, update, verify, and troubleshoot easily.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free consultation

How to update n8n to the latest version?

To update n8n to the latest version, you need to follow specific steps based on your installation method. For Docker users, pull the latest image and restart the container. For npm installations, use npm update commands. Self-hosted instances require downloading the latest version and following the upgrade process documented in n8n's official guides.

 

Comprehensive Guide to Updating n8n to the Latest Version

 

This comprehensive guide covers all methods to update your n8n installation to the latest version. Follow the specific instructions that match your current installation method.

 

Step 1: Preparation Before Updating

 

Before updating n8n, it's crucial to take some preparatory steps to ensure a smooth upgrade process:

  • Back up your n8n database to prevent data loss
  • Check the current version of n8n you're running
  • Review release notes for any breaking changes
  • Schedule the update during a maintenance window if you're running n8n in production

To check your current n8n version, run:

n8n --version

Or navigate to the Settings → About section in the n8n web interface.

 

Step 2: Backing Up Your Data

 

A backup is essential before any update process. Here's how to back up your n8n data:

For SQLite (default):

cp ~/.n8n/database.sqlite ~/.n8n/database.sqlite.backup

For PostgreSQL:

pg_dump -U [username] -d [database_name] > n8n\_backup.sql

For MySQL/MariaDB:

mysqldump -u [username] -p [database_name] > n8n_backup.sql

Additionally, back up your workflows by exporting them from the n8n interface or by copying your .n8n directory.

 

Step 3: Update Method - Docker Installation

 

If you're using Docker to run n8n, follow these steps to update:

Step 3.1: Pull the latest n8n image

For the latest stable version:

docker pull n8nio/n8n

For a specific version:

docker pull n8nio/n8n:0.226.0

Step 3.2: Stop the current container

docker stop n8n

Step 3.3: Remove the current container (optional)

docker rm n8n

Step 3.4: Start a new container with the updated image

docker run -d --restart=always \\
  --name n8n \\
  -p 5678:5678 \\
  -v ~/.n8n:/home/node/.n8n \\
  n8nio/n8n

Make sure to include any custom environment variables or volume mounts from your original configuration.

Step 3.5: For Docker Compose

If you're using Docker Compose:

docker-compose pull
docker-compose down
docker-compose up -d

 

Step 4: Update Method - NPM Installation

 

If you installed n8n using npm, follow these steps to update:

Step 4.1: Update globally installed n8n

npm update -g n8n

For a specific version:

npm install -g [email protected]

Step 4.2: Restart n8n service

If you're running n8n as a service:

sudo systemctl restart n8n

Or if you're running it directly:

n8n start

 

Step 5: Update Method - Debian/Ubuntu Package

 

If you installed n8n using the Debian/Ubuntu package, follow these steps:

Step 5.1: Update package lists

sudo apt update

Step 5.2: Upgrade n8n package

sudo apt upgrade n8n

Step 5.3: Restart the service

sudo systemctl restart n8n

 

Step 6: Update Method - n8n.cloud Managed Service

 

If you're using the official n8n.cloud managed service:

  • Updates are handled automatically by the n8n team
  • You'll receive notifications before major updates
  • No action is required from your side for regular updates

 

Step 7: Update Method - Kubernetes

 

For Kubernetes deployments:

Step 7.1: Update the image tag in your deployment YAML

spec:
  containers:
- name: n8n
    image: n8nio/n8n:latest  # or a specific version like n8nio/n8n:0.226.0

Step 7.2: Apply the updated configuration

kubectl apply -f n8n-deployment.yaml

Step 7.3: Verify the rollout

kubectl rollout status deployment/n8n

If you're using Helm:

helm upgrade n8n n8n/n8n --version X.Y.Z

 

Step 8: Post-Update Verification

 

After updating, verify that everything is working correctly:

Step 8.1: Check the n8n version

Access the n8n web interface and navigate to Settings → About to confirm the version has been updated.

Step 8.2: Verify workflows are running

  • Check that all your workflows are present
  • Test critical workflows to ensure they're functioning correctly
  • Check execution history for any errors

Step 8.3: Check credentials

Verify that all your credentials are still working properly, especially if there were any breaking changes related to specific nodes.

 

Step 9: Troubleshooting Common Update Issues

 

If you encounter issues after updating, try these troubleshooting steps:

Issue: Database migration errors

Solution:

n8n export:workflow --all --output=workflows-backup.json
n8n reset

Then restore your workflows:

n8n import:workflow --input=workflows-backup.json

Issue: Node compatibility problems

Solution: Check the release notes for deprecated nodes and update your workflows accordingly. Some nodes might have been renamed or replaced with newer versions.

Issue: Docker container won't start

Solution: Check the logs for errors:

docker logs n8n

Issue: Performance degradation after update

Solution: Check system resources and database performance. You might need to adjust resource allocation, especially if new features require more resources.

 

Step 10: Updating from Very Old Versions

 

If you're updating from a version that's several major releases behind, consider a staged update approach:

  • Update to an intermediate version first, then to the latest
  • Pay extra attention to breaking changes across multiple versions
  • Consider creating a test environment to validate the update before applying to production

For example, if upgrading from version 0.150.0 to 0.226.0, you might want to upgrade to 0.180.0 first, test thoroughly, then upgrade to 0.226.0.

 

Step 11: Managing Environment Variables

 

Some updates might introduce new environment variables or change the behavior of existing ones. Check the release notes and update your environment configuration accordingly.

Common environment variables to review:

N8N_ENCRYPTION_KEY
N8N_AUTH_ENABLED
N8N\_PORT
N8N\_PROTOCOL
N8N\_HOST
DB\_TYPE
DB_POSTGRESDB_DATABASE
DB_POSTGRESDB_HOST
DB_POSTGRESDB_PORT
DB_POSTGRESDB_USER
DB_POSTGRESDB_PASSWORD

 

Step 12: Automating n8n Updates

 

For automated updates in a Docker environment, you can use tools like Watchtower:

docker run -d \\
  --name watchtower \\
  -v /var/run/docker.sock:/var/run/docker.sock \\
  containrrr/watchtower \\
  --interval 86400 \\
  n8n

This will check for updates once a day and automatically update your n8n container when new versions are available.

For npm installations, you could create a cron job:

0 2 _ _ 0 npm update -g n8n && sudo systemctl restart n8n

 

Step 13: Rollback Procedures

 

If something goes wrong with the update, here's how to roll back to your previous version:

Docker rollback:

docker stop n8n
docker rm n8n
docker run -d --restart=always \\
  --name n8n \\
  -p 5678:5678 \\
  -v ~/.n8n:/home/node/.n8n \\
  n8nio/n8n:previous-version-tag

NPM rollback:

npm install -g n8n@previous-version
sudo systemctl restart n8n

Debian/Ubuntu package rollback:

sudo apt install n8n=previous-version
sudo systemctl restart n8n

If database migrations have already occurred, you may need to restore from your backup.

 

Conclusion

 

Updating n8n regularly ensures you have access to the latest features, security patches, and bug fixes. By following this comprehensive guide, you can safely update your n8n instance regardless of how it was originally installed.

Remember to always:

  • Back up your data before updating
  • Check release notes for breaking changes
  • Test your workflows after updating
  • Have a rollback plan in case of issues

For the most up-to-date information, refer to the official n8n documentation at https://docs.n8n.io/.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022