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:
- Verified the
package.json
file is correctly formatted andnext
is specified in"dependencies"
. - Added
next
to"devDependencies"
as suggested. - Ensured the framework preset is set to Next.js in Vercel’s settings.
- Cleared Vercel’s cache and triggered a rebuild.
- Checked that the build command is set to
npm run build
(ornext build
) and the output directory is.next
. - 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?