当我试图为nextjs构建代码时,它将显示
info - Compiled successfully
warn - Restarted collecting page data for /dashboard/widget because it took more than 60 seconds
warn - See more info here https://nextjs.org/docs/messages/static-page-generation-timeout
> Build error occurred
Error: Collecting page data for /dashboard/widget is still timing out after 2 attempts. See more info here https://nextjs.org/docs/messages/page-data-collection-timeout
at onRestart (C:\PERSONAL\projects\admin\node_modules\next\dist\build\index.js:444:31)
at Worker1.isPageStatic (C:\PERSONAL\projects\admin\node_modules\next\dist\lib\worker.js:49:40)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Span.traceAsyncFn (C:\PERSONAL\projects\admin\node_modules\next\dist\telemetry\trace\trace.js:60:20)
at async C:\PERSONAL\projects\admin\node_modules\next\dist\build\index.js:506:48
at async Span.traceAsyncFn (C:\PERSONAL\projects\admin\node_modules\next\dist\telemetry\trace\trace.js:60:20)
at async Promise.all (index 24)
at async C:\PERSONAL\projects\admin\node_modules\next\dist\build\index.js:491:13
at async Span.traceAsyncFn (C:\PERSONAL\projects\admin\node_modules\next\dist\telemetry\trace\trace.js:60:20)
at async C:\PERSONAL\projects\admin\node_modules\next\dist\build\index.js:468:127
at async Span.traceAsyncFn (C:\PERSONAL\projects\admin\node_modules\next\dist\telemetry\trace\trace.js:60:20)
at async Object.build [as default] (C:\PERSONAL\projects\admin\node_modules\next\dist\build\index.js:77:25)
info - Collecting page data .npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! admin@0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the admin@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\sgarg\AppData\Roaming\npm-cache\_logs\2022-04-12T08_11_02_994Z-debug.log
代码编译是成功的,它没有显示出任何错误的排序。可能的问题是什么?
发布于 2022-04-13 15:14:24
从官方网站
Increase the timeout by changing the staticPageGenerationTimeout configuration option (default 60 in seconds).
因此,我将next.config.js中的staticPageGenerationTimeout
更新为100秒。
而且起作用了。
https://stackoverflow.com/questions/71839345
复制相似问题