#how to update to next js 15.1 from nextjs 15.

1 messages · Page 1 of 1 (latest)

polar crow
#

i m using next js 15. but when i try to update i get npm error.

visual micaBOT
#

Hi @polar crow. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To update from Next.js 15 to 15.1, you should typically be able to use the standard npm update command. However, since you're encountering an npm error, it's likely due to peer dependency conflicts, which are common when updating to newer versions of Next.js, especially with pre-release versions of React.

Based on the information from the Next.js 15 Upgrade Guide (https://nextjs.org/docs/app/building-your-application/upgrading/version-15), here are some steps you can try:

  1. First, ensure you're using the latest versions of React and React DOM:

    npm i next@latest react@latest react-dom@latest eslint-config-next@latest
    
  2. If you see peer dependency warnings, you might need to use the --force or --legacy-peer-deps flag:

    npm i next@latest react@latest react-dom@latest eslint-config-next@latest --force
    
  3. If you're using TypeScript, make sure to also upgrade @types/react and @types/react-dom to their latest versions.

  4. If you're still encountering issues, you can try using the upgrade codemod:

    npx @next/codemod@canary upgrade latest
    

If you continue to face errors, it would be helpful to see the specific npm error message you're receiving. Some users have reported success by adding overrides to their package.json:

"overrides": {
  "react": "$react",
  "react-dom": "$react-dom"
}

Remember, these are temporary solutions until both Next.js 15 and React 19 are stable. If you're working on a production application, it might be safer to wait for the stable release before updating.

Next.js 15 Upgrade Guide (https://nextjs.org/docs/app/building-your-application/upgrading/version-15)

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: