# How to Update n8n to the Latest Version Safely

- Tool: n8n
- Difficulty: Beginner
- Time required: 10-15 minutes
- Compatibility: n8n 1.0+, npm or Docker installations
- Last updated: March 2026

## TL;DR

Update n8n by running npm update -g n8n for npm installs or docker pull docker.n8n.io/n8nio/n8n for Docker. Always update incrementally through major versions to avoid breaking changes. Check your current version with n8n --version before updating and review the release notes for migration steps.

## How to Update n8n to the Latest Version

Keeping n8n up to date ensures you have the latest nodes, bug fixes, security patches, and performance improvements. The update process differs depending on whether you installed n8n via npm or Docker. The most important rule is to never skip major versions — always update incrementally (e.g., from 0.x to 1.0, then 1.0 to 1.x) to ensure database migrations run correctly.

## Before you start

- A running n8n instance installed via npm or Docker
- Access to the terminal or command line on your server
- A backup of your n8n database and workflows before updating
- Node.js 18+ installed if using npm

## Step-by-step guide

### 1. Check your current n8n version

Before updating, you need to know which version you are running. This determines whether you can jump straight to the latest version or need to update incrementally through major releases. Run the version check command and compare the output with the latest release on the n8n GitHub releases page or npm registry.

```
# For npm installations
n8n --version

# For Docker installations
docker exec <container_name> n8n --version

# Check the latest available version on npm
npm view n8n version
```

**Expected result:** You see your current version number printed in the terminal, such as 1.42.0, and can compare it to the latest available version.

### 2. Back up your data before updating

Always create a backup before updating n8n, especially before major version upgrades. If you are using the default SQLite database, back up the .n8n folder in your home directory. For PostgreSQL, create a database dump. This ensures you can roll back if something goes wrong during the update.

```
# Back up the .n8n directory (SQLite)
cp -r ~/.n8n ~/.n8n-backup-$(date +%Y%m%d)

# Back up PostgreSQL database
pg_dump -U n8n_user -d n8n_db > n8n_backup_$(date +%Y%m%d).sql

# For Docker with a named volume
docker run --rm -v n8n_data:/data -v $(pwd):/backup alpine tar czf /backup/n8n_data_backup.tar.gz /data
```

**Expected result:** A timestamped backup of your n8n data directory or database is created and stored safely.

### 3. Update n8n via npm

If you installed n8n globally via npm, updating is a single command. For minor and patch updates within the same major version, you can update directly. For major version jumps, you must update to the last release of each major version first, then move to the next major version. This ensures all database migrations run in the correct order.

```
# Update to the latest version (same major)
npm update -g n8n

# Update to a specific version (for incremental major upgrades)
npm install -g n8n@1.0.0

# After installing, restart n8n
n8n start
```

**Expected result:** npm downloads and installs the specified n8n version. When you run n8n start, the new version launches and any pending database migrations run automatically.

### 4. Update n8n via Docker

For Docker installations, pull the latest image and recreate the container. Make sure your workflow data is stored in a Docker volume or an external database so it persists across container restarts. If you need to update incrementally, pull a specific tag instead of latest.

```
# Pull the latest n8n Docker image
docker pull docker.n8n.io/n8nio/n8n

# Pull a specific version for incremental updates
docker pull docker.n8n.io/n8nio/n8n:1.0.0

# Stop and remove the old container
docker stop n8n && docker rm n8n

# Start a new container with the updated image
docker run -d --name n8n \
  -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n
```

**Expected result:** The new container starts with the updated n8n version. Open http://localhost:5678 and verify the version number in the bottom-left corner of the n8n UI.

### 5. Verify the update and test workflows

After updating, confirm the new version is running and test your critical workflows. Open the n8n editor, check the version number displayed in the UI footer, and manually execute your most important workflows to confirm they still work correctly. Pay attention to any deprecation warnings in the execution output.

```
# Verify version from command line
n8n --version

# Check the n8n health endpoint
curl http://localhost:5678/healthz
```

**Expected result:** The version command returns the expected new version number. Your test workflows execute successfully without errors. The health endpoint returns a 200 OK response.

## Complete code example

File: `update-n8n.sh`

```bash
#!/bin/bash
# n8n Update Script — safe incremental update with backup

set -e

echo "=== n8n Update Script ==="

# Step 1: Check current version
CURRENT_VERSION=$(n8n --version 2>/dev/null || echo "not installed")
echo "Current n8n version: $CURRENT_VERSION"

# Step 2: Check latest available version
LATEST_VERSION=$(npm view n8n version)
echo "Latest n8n version: $LATEST_VERSION"

if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
  echo "Already on the latest version. No update needed."
  exit 0
fi

# Step 3: Back up the .n8n directory
BACKUP_DIR="$HOME/.n8n-backup-$(date +%Y%m%d-%H%M%S)"
echo "Creating backup at $BACKUP_DIR"
cp -r "$HOME/.n8n" "$BACKUP_DIR"
echo "Backup created successfully."

# Step 4: Stop n8n if running as a service
if systemctl is-active --quiet n8n 2>/dev/null; then
  echo "Stopping n8n service..."
  sudo systemctl stop n8n
fi

# Step 5: Update n8n
echo "Updating n8n to version $LATEST_VERSION..."
npm update -g n8n

# Step 6: Verify the update
NEW_VERSION=$(n8n --version)
echo "Updated to n8n version: $NEW_VERSION"

# Step 7: Restart n8n service if it was running
if systemctl is-enabled --quiet n8n 2>/dev/null; then
  echo "Restarting n8n service..."
  sudo systemctl start n8n
  echo "n8n service restarted."
fi

echo "=== Update complete ==="
echo "Backup location: $BACKUP_DIR"
echo "Please test your workflows to confirm everything works."
```

## Common mistakes

- **Skipping major versions during update (e.g., jumping from 0.200 to 1.30)** — undefined Fix: Update to the last release of each major version first (e.g., 0.x → 1.0.0 → 1.x latest), then proceed to the next major version so all database migrations run in order.
- **Not backing up before updating and losing workflow data** — undefined Fix: Always run a backup of your .n8n directory or database dump before any update. Store the backup in a separate location from your server.
- **Using docker pull without recreating the container** — undefined Fix: After pulling a new image, you must stop and remove the old container, then create a new one. The existing container still uses the old image until replaced.
- **Updating n8n while workflows are actively executing** — undefined Fix: Wait for all running executions to complete or pause them before updating. Interrupted executions may leave data in an inconsistent state.

## Best practices

- Always back up your database and .n8n directory before updating, especially before major version upgrades
- Update incrementally through major versions — never skip from 0.x directly to the latest 1.x release
- Read the release notes and changelog for each major version to understand breaking changes
- Test your critical workflows immediately after updating to catch any compatibility issues early
- Pin your Docker image to a specific version tag in production instead of using latest
- Schedule updates during low-traffic periods when workflows are not actively executing
- Keep your Node.js version up to date — n8n requires Node.js 18 or higher

## Frequently asked questions

### Can I skip major versions when updating n8n?

No. You must update incrementally through each major version. For example, if you are on version 0.236, first update to 1.0.0, then to the latest 1.x release. Skipping major versions can cause database migration failures and data loss.

### Will updating n8n delete my workflows?

No, updating n8n preserves your workflows and credentials as long as your data is stored in a persistent location such as the .n8n directory or an external PostgreSQL database. Always back up before updating as a precaution.

### How do I roll back to a previous n8n version?

For npm, install the specific version with npm install -g n8n@VERSION. For Docker, pull the specific tag with docker pull docker.n8n.io/n8nio/n8n:VERSION. Restore your database backup before starting the older version to avoid migration conflicts.

### How often should I update n8n?

Check for updates monthly. Apply security patches immediately. For major version updates, wait a week after release for any hotfixes, then update during a maintenance window.

### Do I need to update community nodes separately?

Yes. Community nodes are managed independently. After updating n8n, go to Settings, then Community Nodes to check for available updates. Some community nodes may need updates to remain compatible with the new n8n version.

### What happens if an update fails halfway through?

If the update process is interrupted, restore your backup and try again. For npm, reinstall the previous version with npm install -g n8n@PREVIOUS_VERSION. For Docker, run the container with the previous image tag.

---

Source: https://www.rapidevelopers.com/n8n-tutorial/how-to-update-n8n-to-the-latest-version
© RapidDev — https://www.rapidevelopers.com/n8n-tutorial/how-to-update-n8n-to-the-latest-version
