Skip to content

Upgrading Next.js

Next.js releases major versions with new features, performance improvements, and breaking changes. Upgrading requires planning and testing.

Each new version of Next.js includes performance improvements, new features, and security patches. Staying current gives you access to the latest capabilities.

Terminal window
# Check installed version
npx next --version
# Check what's available
npm show next version # Latest stable
npm show next versions # All versions
Terminal window
# Every major release has an upgrade guide
# https://nextjs.org/docs/app/building-your-application/upgrading
Terminal window
# Run the build to see deprecation warnings
npm run build
# Check for deprecated APIs in your code
Terminal window
# Install the latest version
npm install next@latest
# Update related packages (react, react-dom)
npm install react@latest react-dom@latest

Common breaking changes include:

  • API changes (e.g., getServerSideProps → Server Components)
  • Configuration changes (next.config.js options)
  • Dependency updates (Node.js version requirements)
  • Image component changes
Terminal window
# Build and check for errors
npm run build
# Run tests
npm test
# Start production server and check manually
npm start
  • Read the official migration guide
  • Check Node.js version requirements
  • Update next and related packages
  • Resolve any TypeScript errors
  • Run the full test suite
  • Test in a preview deployment
  • Monitor after production deployment
  • Skipping versions — Upgrade one major version at a time. Skipping versions (e.g., 12 → 14) makes migration much harder.
  • Not checking the changelog — Each major version has specific breaking changes. Read the migration guide.
  • Upgrading before testing — Always test the upgrade in a development or preview environment first.
  • Upgrade one major version at a time (e.g., 13 → 14, not 12 → 14)
  • Read the official migration guide for each version
  • Run the full test suite after upgrading
  • Test in a preview deployment before production
  • Update react and react-dom at the same time

Upgrading Next.js requires planning. Read the migration guide, upgrade one major version at a time, and test thoroughly. Use preview deployments to verify before deploying to production.