我正在尝试使用 Next.js 和我的自定义后端与 Django 开发 Next.js 应用程序。我已经完成了它开发我想要的一切但是当我尝试将它部署到 Vercel 时它给我 getStaticPaths 错误每次我这样做,但是我尝试制作我可以使用 Next.js 和动态路由它工作正常,没有任何问题。
你能帮我吗,因为这是开发我的博客应用程序的最后一步
我遇到的错误 =>
PS D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode> npm run build
> downthecode@0.1.0 build D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode
> next build && next export
info - Using webpack 5. Reason: no next.config.js https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
[== ] info - Generating static pages (0/16)
Error occurred prerendering page "/cateogary/[cateogary]". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read property '0' of undefined
at cateogaryPageFun (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\.next\server\pages\cateogary\[cateogary].js:63:39)
at d (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:33:498)
at bb (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:36:16)
at a.b.render (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:42:43)
at a.b.read (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:41:83)
at exports.renderToString (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:52:138)
at Object.renderPage (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\server\render.js:54:854)
at Function.getInitialProps (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\.next\server\pages\_document.js:603:19)
at loadGetInitialProps (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\lib\utils.js:5:101)
at renderToHTML (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\server\render.js:54:1145)
Error occurred prerendering page "/hashtag/[hashtag]". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read property 'map' of undefined
at hashtagPageFun (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\.next\server\pages\hashtag\[hashtag].js:117:35)
at d (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:33:498)
at bb (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:36:16)
at a.b.render (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:42:43)
at a.b.read (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:41:83)
at exports.renderToString (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:52:138)
at Object.renderPage (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\server\render.js:54:854)
at Function.getInitialProps (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\.next\server\pages\_document.js:603:19)
at loadGetInitialProps (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\lib\utils.js:5:101)
at renderToHTML (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\server\render.js:54:1145)
[=== ] info - Generating static pages (8/16)
Error occurred prerendering page "/posts/[post]". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read property 'Headline' of undefined
at index (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\.next\server\pages\posts\[post].js:745:32)
at d (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:33:498)
at bb (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:36:16)
at a.b.render (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:42:43)
at a.b.read (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:41:83)
at exports.renderToString (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\react-dom\cjs\react-dom-server.node.production.min.js:52:138)
at Object.renderPage (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\server\render.js:54:854)
at Function.getInitialProps (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\.next\server\pages\_document.js:603:19)
at loadGetInitialProps (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\lib\utils.js:5:101)
at renderToHTML (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\next-server\server\render.js:54:1145)
info - Generating static pages (16/16)
> Build error occurred
Error: Export encountered errors on following paths:
/cateogary/[cateogary]
/hashtag/[hashtag]
/posts/[post]
at D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\export\index.js:31:1106
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Span.traceAsyncFn (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\telemetry\trace\trace.js:6:584)
at async D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\build\index.js:45:49
at async Span.traceAsyncFn (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\telemetry\trace\trace.js:6:584)
at async D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\build\index.js:27:1475
at async Span.traceAsyncFn (D:\Web Developement\Next Projects\BlogX\Down the Code\downthecode\node_modules\next\dist\telemetry\trace\trace.js:6:584)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! downthecode@0.1.0 build: `next build && next export`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the downthecode@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\coder\AppData\Roaming\npm-cache\_logs\2021-07-25T09_16_55_757Z-debug.log
可以在这里找到回购代码 =>https://github.com/coderaman07/Days-of-Code