Issue with Next.js Version Detection in Vercel Deployment

I’m encountering an issue when deploying my Next.js application to Vercel. Despite having the correct Next.js version specified in package.json and following Vercel’s guidelines, the build process fails with an error stating that Vercel cannot detect the Next.js version. Here are the details:

  • Framework: Next.js (v14.1.3)
  • React: v18.2.0
  • Error Message:
Warning: Could not identify Next.js version, ensure it is defined as a project dependency.
Error: No Next.js version detected. Make sure your package.json has "next" in either "dependencies" or "devDependencies".

Steps Taken:

  1. Verified the package.json file is correctly formatted and next is specified in "dependencies".
  2. Added next to "devDependencies" as suggested.
  3. Ensured the framework preset is set to Next.js in Vercel’s settings.
  4. Cleared Vercel’s cache and triggered a rebuild.
  5. Checked that the build command is set to npm run build (or next build) and the output directory is .next.
  6. Verified my local environment is using Node.js v18.x, matching Vercel’s environment.

Vercel Logs: The logs consistently indicate that Vercel cannot detect the Next.js version, despite it being present in the package.json.

Can anyone provide further guidance on why Vercel might not be recognizing the Next.js version and how I can resolve this?

It looks like you are committing a zip file to GitHub and then Vercel can’t read the package.json within it

You’ll need to unzip and commit the files regularly

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.