nextjs的一些报错及解决方法
1.build
打包时出现如下错误
Generating static pages (2/10) [= ]TypeError: fetch failed
at node:internal/deps/undici/undici:13178:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0) {
[cause]: AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1118:18)
at afterConnectMultiple (node:net:1685:7)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'ECONNREFUSED',
[errors]: [ [Error], [Error] ]
}
}
在相应的页面加上
export const dynamic = "force-dynamic";
比如你的首页为一个动态的List
表
License:
CC BY 4.0