Unable to deploy nextjs project: "Error: Cannot find module 'next/dist/next-server/server/config'"

Hi everyone,

I’ve been trying to deploy my NextJS project on Netlify, but I’m encountering an issue when building.

I followed the next-on-netlify instructions, but when I deploy, I get this error after the SSG step:

9:23:23 PM: ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
9:23:23 PM: > next-js-boilerplate@1.0.0 postbuild
9:23:23 PM: > next-on-netlify
9:23:23 PM: node:internal/modules/cjs/loader:936
9:23:23 PM:   throw err;
9:23:23 PM:   ^
9:23:23 PM: Error: Cannot find module 'next/dist/next-server/server/config'
9:23:23 PM: Require stack:
9:23:23 PM: - /opt/build/repo/node_modules/next-on-netlify/lib/helpers/getNextConfig.js

Deploy: Netlify App

Source: GitHub - ontola/home at next-website

Thanks in advance!

Hey there, @joepio :wave:

Thanks for reaching out! Can you confirm which version of our plugin you are using? If you aren’t using the latest version of our plugin, can you try updating it? You can see more info here: Releases · netlify/next-runtime · GitHub