The Problem
When deploying Next.js 15 applications to Vercel, you might encounter an ERESOLVE error during the build process, particularly with package
and React dependencies. This usually occurs due to conflicting peer dependencies between packages.
Quick Solution
Here's how to resolve this issue:
Navigate to your project's settings in Vercel dashboard
Find the "Build & Development Settings" section
Look for the "Install Command" field
Override the default by entering:
npm install --force
Redeploy your application
Why This Works
The --force
flag tells npm to bypass dependency conflicts and proceed with the installation anyway. While this isn't always the best practice for local development, it's often necessary for deployment scenarios where package conflicts need to be overridden.
Important Notes
Only use this solution if you're confident about your package versions
Consider reviewing your package dependencies for a more permanent solution
This fix is specifically for Next.js 15 deployments on Vercel
Alternative Approaches
For a more sustainable solution, you might want to:
Update your dependencies to compatible versions
Use package resolutions in your package.json
Consider using yarn instead of npm
Remember: The --force
flag should be used as a temporary solution while you work on resolving the underlying dependency conflicts.
Got questions? Feel free to reach out in the comments below!