To Update or Upgrade your Nextjs APP, open your package.json file to remove the next, react and react-dom versions, delete the node_module folder and run npm install, and you can now able to install specific versions of next, react and react-dom. In the same way, you can update to the latest version of next
 Why update is vital?
It is crucial for performance and security because it receives the latest bug fixes and vulnerability assessment improvements. I always recommend you update your app and packages to the newer version.
 Installing Specific Version of the Next, React and React-Dom
Here’s the command you can run to install the latest or a specific version of Next, React, and ReactDOM.
npm install next@15 react@19.0.0 react-dom@19.0.0
Also, follow the next tutorial to update your specific package in the next project.
 But first, you must have a backup of your Nextjs project, in case the latest version is not compatible with some library. So you have the option to install the particular version. 
Updating Nextjs app
Now let me walk you through how you can update the NextJS app and packages,
For this tutorial, we are using the Yarn and NPM package manager. Now, open the terminal in VSCODE and issue this command,
npm install next@latest
  For yarn   yarn add next@latest
    Updating all the Packages
Now, let us go ahead and update the latest version of the packages. You could check the packages are running on the latest version by issuing this command,
npm outdated
  After checking the version, now to update the package, you can issue this command,
npm update
This command will update all the packages.
For Yarn
To update packages while using yarn, you can issue this command in the terminal,
Yarn upgrade
 Updating Packages to the Latest Version,
To update the Nextjs packages, first, issue this command to check the latest version of the packages,
npm-check-update-u
 After that, issuing this command to update the packages,
npm install
This command will update all the packages to the latest version.
 For Yarn
yarn upgrade —latest
  You can also delete the Node Module folder and then issue this command to regenerate the Node Module folder, which is a package manager.
To update the next version. Delete the package.lock.json file, and node_module folder from your project and remove the next version of the package.json.
Incompatible Issue
If you get an incompatible issue, you are required to downgrade the react and the next version. To downgrade the next or react version, you have to remove the react and next version from the package.json file and also delete the packages.lock file and delete node_module file.
After that issue of this command,
npm install
Then after, install the react and the next version,
Now, you can start the development environment by issuing the above command and checking the terminal if you are facing an error.
npm run dev
Now, If you are still getting the same error, the only option is to create a new app.