Build issues when upgrading form "@netlify/plugin-nextjs": "4" to "@netlify/plugin-nextjs": "5"

Hi their this is our preview website (https://preview.ionic.money)which is crashing when we are upgrading the @netlify/plugin-nextjs form version 4 to 5 and then it gives this error `Error: Cannot find module ‘next/dist/compiled/next-server/app-page.runtime.dev.js’
Require stack:

  • /var/task/node_modules/next/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader.js
  • /var/task/node_modules/next/dist/server/lib/render-server.js
  • /var/task/node_modules/next/dist/server/lib/router-server.js
  • /var/task/node_modules/next/dist/server/lib/start-server.js
  • /var/task/packages/ui/.netlify/dist/run/next.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at /var/task/node_modules/next/dist/server/require-hook.js:55:36
    at Function.resolve (node:internal/modules/helpers:190:19)
    at Object. (/var/task/node_modules/next/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader.js:41:13)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions…js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at mod.require (/var/task/node_modules/next/dist/server/require-hook.js:65:28)`

please help

Hi @amish777,

Thanks for reaching out and welcome to Netlify’s Support Forums!

For version 5 of the Netlify/Next.js runtime, you’ll want to review this Netlify doc:

We also have a Starter Template here:

With a Netlify form to see how it’s coded. The relevant parts here:

the .html file:

and the js/jsx:

If you want to compare your code to that of the template.

Could you give that a try and let us know if you continue to have issues?