Getting Started
Core Concepts
Troubleshooting
Keeping your Next.js application up-to-date ensures you have access to the latest performance improvements, security patches, and new features like the App Router, Turbopack, and React updates. Next.js provides built-in CLI commands and automated code transformation tools (codemods) to streamline upgrading your dependencies and refactoring your codebase.
Note
Before running any upgrade commands or codemods, make sure your git working directory is completely clean by committing or stashing your changes, or use the --force flag to bypass this safety check.
You can upgrade your Next.js application to a newer version or distribution channel using the built-in upgrade command.
When running the upgrade command, you can specify a target revision to determine which version of Next.js to install.
Supported revisions:
latest, canary, rc, betapatch, minor, major15.0.0Tip
If you do not provide a revision, the upgrade command automatically defaults to minor or matches your project's current release channel (such as canary).
Codemods are automated scripts that programmatically update your source code to handle breaking changes, rename deprecated components or configuration properties, and adopt new API conventions across major versions.
You can apply a specific codemod to your project files by running the transform tool and passing the codemod name:
npx @next/codemod <codemod-slug> [source-path]The following automated transforms are available to help refactor your codebase across different Next.js versions:
Warning
Codemods modify your application files directly. Always review the changes in your version control system after running a transform.
The standard upgrade and migration workflow follows these steps: