Upgrading Netlify Nextjs Plugine

Hello everyone.

I am getting an internal server error when deployed my NextJs app.
The specific error is: Error: Cannot find module 'next/dist/server/future/route-modules/pages/vendored/contexts/amp-context

On the issues page here: [Bug]: `Error: Cannot find module 'next/dist/server/future/route-modules/pages/vendored/contexts/amp-context'` in NextJS preview mode · Issue #2329 · netlify/next-runtime · GitHub,
It mentions that it has been fixed in the v5 of the Nextjs plugin.

When I created a new app and deployed it but the build logs shows that v4 is still used. And the prompt message to change it is not helpful.

I have attached a screenshot of the issue.

Any help will be deeply appreciated.

@WellaHealth The appropriate Netlify documentation here:

Next.js 13.5+ on Netlify

https://docs.netlify.com/frameworks/next-js/overview/

Next.js 10-13.4 on Netlify

https://docs.netlify.com/frameworks/next-js/runtime-v4/overview/

Thanks for the response @nathanmartin

From the docs, I have to be using
Next 13.5+, and Node 18+

My Nextjs version is 14.0

My Node is also set to v20

The warning message in the build says to uninstall and reinstall, but the plugin cannot be found on the plugins page. Another post mentions checking the Build Settings, but as seen below, one can only select the runtime and not the versions.

Just to add, I am not using netlify.toml file. I connected the site to repo and it detected it as a netlify project.

Hi @WellaHealth,

Sorry to hear about the issue. Could you share the site name (such as sitename.netlify.app) so we can investigate this issue deeper?

Thanks @Melvin
Here is the site:

https://wella-changelog.netlify.app/

Hi @WellaHealth,

Thanks for providing the requested information.

Could you try adding:

"@netlify/plugin-nextjs": "^5.7.2",

to your package.json, under dependences?

Also adding:

[[plugins]]
  package = "@netlify/plugin-nextjs"

to the netlify.toml file?

Thanks for the helpful tip. We are not using a netlify.toml. But we will add and try again