How to upgrade to version 15
Upgrade your Next.js Application from Version 14 to 15.
Upgrading from 14 to 15
To update to Next.js version 15, you can use the upgrade codemod:
If you prefer to do it manually, ensure that you're installing the latest Next & React versions:
Good to know:
- If you see a peer dependencies warning, you may need to update
reactandreact-domto the suggested versions, or use the--forceor--legacy-peer-depsflag to ignore the warning. This won't be necessary once both Next.js 15 and React 19 are stable.
React 19
- The minimum versions of
reactandreact-domis now 19.
useFormStatehas been replaced byuseActionState. TheuseFormStatehook is still available in React 19, but it is deprecated and will be removed in a future release.useActionStateis recommended and includes additional properties like reading thependingstate directly. Learn more.useFormStatusnow includes additional keys likedata,method, andaction. If you are not using React 19, only thependingkey is available. Learn more.- Read more in the React 19 upgrade guide.
Good to know: If you are using TypeScript, ensure you also upgrade @types/react and @types/react-dom to their latest versions.
Async Request APIs (Breaking change)
Previously synchronous Request-time APIs that rely on request information are now asynchronous:
cookiesheadersdraftModeparamsinlayout.js,page.js,route.js,default.js,opengraph-image,twitter-image,icon, andapple-icon.searchParamsinpage.js
To ease the burden of migration, a codemod is available to automate the process and the APIs can temporarily be accessed synchronously.
cookies
Recommended Async Usage
Temporary Synchronous Usage
headers
Recommended Async Usage
Temporary Synchronous Usage
draftMode
Recommended Async Usage
Temporary Synchronous Usage
params & searchParams
Asynchronous Layout
Synchronous Layout
Asynchronous Page
Synchronous Page
Route Handlers
runtime configuration (Breaking change)
The runtime segment configuration previously supported a value of experimental-edge in addition to edge. Both configurations refer to the same thing, and to simplify the options, we will now error if experimental-edge is used. To fix this, update your runtime configuration to edge. A codemod is available to automatically do this.
fetch requests
fetch requests are no longer cached by default.
To opt specific fetch requests into caching, you can pass the cache: 'force-cache' option.
To opt all fetch requests in a layout or page into caching, you can use the export const fetchCache = 'default-cache' segment config option. If individual fetch requests specify a cache option, that will be used instead.
Route Handlers
GET functions in Route Handlers are no longer cached by default. To opt GET methods into caching, you can use a route config option such as export const dynamic = 'force-static' in your Route Handler file.
Client Cache
When navigating between pages via <Link> or useRouter, page segments are no longer reused from the Client Cache. However, they are still reused during browser backward and forward navigation and for shared layouts.
To opt page segments into caching, you can use the staleTimes config option:
Layouts and loading states are still cached and reused on navigation.
next/font
The @next/font package has been removed in favor of the built-in next/font. A codemod is available to safely and automatically rename your imports.
bundlePagesRouterDependencies
experimental.bundlePagesExternals is now stable and renamed to bundlePagesRouterDependencies.
serverExternalPackages
experimental.serverComponentsExternalPackages is now stable and renamed to serverExternalPackages.
Speed Insights
Auto instrumentation for Speed Insights was removed in Next.js 15.
To continue using Speed Insights, follow the Vercel Speed Insights Quickstart guide.
NextRequest Geolocation
The geo and ip properties on NextRequest have been removed as these values are provided by your hosting provider. A codemod is available to automate this migration.
If you are using Vercel, you can alternatively use the geolocation and ipAddress functions from @vercel/functions instead:
Troubleshooting
Installation fails after upgrading to React 19
- If another package's peer dependencies reject React 19, revert
react,react-dom, their types, andreact-is(if present) to the previous versions, provided the target Next.js version and router support them. - Restore or remove React type overrides or resolutions added by the upgrade in
package.jsonorpnpm-workspace.yaml. - If installation interrupted the upgrade command, retry the same exact target with
--skip-react-upgradeto preserve the repaired dependencies. If Next.js already matches the target, install dependencies and run any skipped codemods individually. Run the app's checks.
Installation fails after upgrading to ESLint 9
- If another package's peer dependencies reject ESLint 9, restore the previous compatible versions of
eslint,eslint-config-next, and@next/eslint-plugin-next(if present), along with the previous lint configuration. - If installation interrupted the upgrade command, retry the same exact target with
--skip-eslint-upgradeto preserve the repaired dependency. If Next.js already matches the target, install dependencies and run any skipped codemods individually. Complete any required lint migration manually, then run the app's lint checks.
Review migration checklist
After applying the changes relevant to your app, review these action items before you consider the migration complete:
- React dependencies and types meet the React 19 requirements for the app's router.
- Font imports use
next/fontinstead of@next/font. - Existing
bundlePagesExternalsandserverComponentsExternalPackagessettings use their documented stable names while preserving package configuration. -
NextRequestgeoandipconsumers use an appropriate source for the actual hosting provider. - Apps that relied on automatic Speed Insights instrumentation have an explicit integration if they still need it.
- The app's supported checks and affected runtime behavior pass. Remaining required failures keep the migration incomplete.
- Async Request API access, including affected helpers and callers, is migrated. Resolve codemod error comments and
UnsafeUnwrappedcasts instead of treating them as completed repairs. - Route segment runtime settings no longer use
experimental-edge.