I’m trying to deploy a Next.js application on Vercel, but I’m encountering an error during the build process.
In addition to the fact that building locally is successful, I deployed the same app over and over in the recent days. But Today it fails without making any changes to the code base.
The error message I’m seeing is:
added 1167 packages in 41s
395 packages are looking for funding
run `npm fund` for details
Detected Next.js version: 14.2.5
Detected `package-lock.json` generated by npm 7+
Running "npm run build"
> nextsaas@0.1.0 build
> prisma generate && next build
Prisma schema loaded from prisma/schema.prisma
Error:
The "path" argument must be of type string. Received undefined
Error: Command "npm run build" exited with 1
Environment and Setup
Next.js version: 14.2.5
Prisma version: Latest (updated)
package.json file contains:
{
"name": "nextsaas",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "prisma generate && next build",
"postbuild": "next-sitemap",
"start": "next start",
"lint": "next lint"
},
"overrides": {
"oidc-token-hash": "5.0.1",
"next-contentlayer": {
"next": "$next"
}
}
....etc
}
Any assistance in resolving this issue would be greatly appreciated. Please let me know if you need any additional information from me.
Thanks for sharing the error message. It’s not a lot of detail, so we’ll need to do some things to get at the cause of the error.
You mentioned that there were no changes to the code base. I want to figure out if there’s a package update or data change that could have caused the error.
I assume something must have changed (though not necessarily the code itself) or you wouldn’t have needed a new deployment. So what was it that did change between this deployment and the previous one?
Does it work if you redeploy a previous deployment?
Does the package.json file have specific versions pinned (e.g. "package-name": "2.0.0"), or does it allow minor version updates (e.g. "package-name": "^2.0.0")?
Hey Amygan,
Thanks for your quick response.
Regarding your first question, Trust me, nothing serious has changed. How do I know that? This web app is based on a boilerplate that I’m using to build two web applications. When I deployed the first one after adding some minor features, I knew right away that something was wrong with Vercel because there was no way that feature could have caused the issue. To verify that, I went to the second app, literally removed a space, and redeployed it. And guess what? It failed at the build phase just like the first one.
And to further verify that, I’ve just redeployed a previous version (that was working just fine), and it failed as well!
regarding your last question, i didn’t understand. I’ve already shared with you a snippet of the package.json file.