英文:
Error while deploying NextJS app to Vercel
问题
你好,我正在尝试将NEXT-JS应用部署到Vercel,但令人讨厌的是,即使在我的项目根目录下有app和pages文件夹,它仍然会给出下面的错误。我尝试在Google上找到解决方案,但我找不到与我的情况相同的解决方案。
这是我的文件结构:
enter image description here
英文:
Hi guys I am trying to deploy NEXT-JS App to Vercel but it keeps giving the error below annoyingly even I have app and pages folders under my project root. I tried to find the solution on google but I couldn't find the same as mine.
enter image description here
here is my folder structure
enter image description here
答案1
得分: 1
首先,请确保在你的 next.config.js
中没有禁用 appDir
。
不要有:
const nextConfig = {
experimental: {
appDir: false,
}
}
期望的是:
const nextConfig = {
}
其次,请确保在你的 npm run build
命令之后没有其他内容,除非使用了 &&
。
不要有:
"build": "next build prisma generate"
期望的是:
"build": "next build && prisma generate"
如果没有使用 &&
,next 会尝试将 prisma 用作目录根目录。
英文:
Firstly, make sure you don't have appDir disabled in your next.config.js.
No:
const nextConfig = {
experimental: {
appDir: false,
}
}
Expected:
const nextConfig = {
}
Secondly, make sure nothing comes after your npm run build
command, without the use of &&
No:
"build": "next build prisma generate"
Expected:
"build": "next build && prisma generate"
Without the &&
next will try to use prisma as a directory root.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论