[英]Error occurred prerendering page "/". Deployment Error Vercel | Next.js
我正在尝试通过 Vercel 部署我的网站,并在生成 static 页面时,它在日志中引发以下错误
info - Generating static pages (0/6)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at a.b.render (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:45:32)
at a.b.read (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
at Object.exports.renderToString (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
at Object.renderPage (/vercel/path0/node_modules/next/dist/server/render.js:686:46)
at Object.defaultGetInitialProps (/vercel/path0/node_modules/next/dist/server/render.js:316:51)
at Function.getInitialProps (/vercel/path0/.next/server/pages/_document.js:514:20)
at Object.loadGetInitialProps (/vercel/path0/node_modules/next/dist/shared/lib/utils.js:69:29)
at renderDocument (/vercel/path0/node_modules/next/dist/server/render.js:699:48)
at renderToHTML (/vercel/path0/node_modules/next/dist/server/render.js:774:34)
at async /vercel/path0/node_modules/next/dist/export/worker.js:273:36
info - Generating static pages (1/6)
[]
info - Generating static pages (2/6)
info - Generating static pages (4/6)
info - Generating static pages (6/6)
> Build error occurred
Error: Export encountered errors on following paths:
/
at /vercel/path0/node_modules/next/dist/export/index.js:500:19
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:74:20)
at async /vercel/path0/node_modules/next/dist/build/index.js:987:17
at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:74:20)
at async /vercel/path0/node_modules/next/dist/build/index.js:861:13
at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:74:20)
at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:82:25)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
我尝试使用提供的 Prerender 错误指南 Next.js 来修复它,但仍然无法修复它。
我的pages
目录结构如下
📦pages
┣ 📂api
┃ ┣ 📂auth
┃ ┃ ┗ 📜[...nextauth].js
┃ ┗ 📜hello.js
┣ 📂auth
┃ ┗ 📜signin.js
┣ 📂[postRoute]
┃ ┗ 📂[currentPost]
┃ ┃ ┗ 📜index.js
┣ 📜dashboard.js
┣ 📜edit.js
┣ 📜index.js
┗ 📜_app.js
这是我的index.js
文件
import Head from "next/head"
import Contribution from "../components/Contribution"
import Features from "../components/Features"
import Footer from "../components/Footer"
import Header from "../components/Header"
import Landing from "../components/Landing"
import SubFooter from "../components/SubFooter"
import styles from "../styles/Home.module.scss"
export default function Home() {
return (
<>
<Head>
<title>Skill Up | Credit Based Learning</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<div className={styles.container}>
<Header />
<Landing />
<hr />
<Features />
<Contribution />
<SubFooter />
<Footer />
</div>
</>
)
}
提前致谢!
在 Landing.js、edit.js 和 index.js 中,您从“react/cjs/react.development”而不是“react”导入了 Fragment。 next build
的 scope 中不存在 React 开发,因此它失败了
提供的解决方案对您有用吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.