简体   繁体   English

npm 在 nextJS 和 vercel 部署中运行构建错误

[英]npm run build error in nextJS and vercel deploy

I have an app already deploy on vercel, i change just aa content in a page and push it on git without problem(i make that many times without problem before), but now i can't execute npm run build return an error, the same error on vercel deploy.我已经在vercel上部署了一个应用程序,我只更改页面中的一个内容并将其推送到git上没有问题(我之前多次没有问题),但现在我无法执行npm运行构建返回错误, vercel 部署上的相同错误。 Can any one help me to fix this issue.任何人都可以帮我解决这个问题。

00:50:06.011 > next.next/build 00:50:06.209 > No such directory exists as the project root: /vercel/workpath0/portfolio/.next/build 00:50:06.011 > next.next/build 00:50:06.209 > 项目根目录不存在这样的目录:/vercel/workpath0/portfolio/.next/build

the script in package.json package.json 中的脚本

"scripts": {
"dev": "next dev",
"build": "next .next/build",
"start": "next start"

}, },

vercel deploy terminal vercel 部署终端

The reason its failing with "No such directory exists" is because the .next directory doesn't exist until you run next build , which is the command that generates the output.它以“不存在此类目录”失败的原因是因为.next目录在您运行next build之前不存在,这是生成 output 的命令。

Change your build script to next build , like it shows in the Next.js docs , and it will work.将您的构建脚本更改为next build ,就像它在Next.js 文档中显示的那样,它将起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM