Cloudflare和next.js静态导出不工作?

wtlkbnrh  于 2022-11-29  发布在  其他
关注(0)|答案(1)|浏览(273)

它正常工作,但突然停止工作,我不知道为什么。如果你能帮助,谢谢!
原木

2022-11-24T13:14:56.98176Z  Executing user command: next build && next export
2022-11-24T13:14:57.075259Z /opt/buildhome/repo/node_modules/next/dist/build/index.js:344
2022-11-24T13:14:57.075558Z                     ...pageKeys.app ?? [], 
2022-11-24T13:14:57.075709Z                                      ^
2022-11-24T13:14:57.075852Z 
2022-11-24T13:14:57.075978Z SyntaxError: Unexpected token '?'
2022-11-24T13:14:57.076087Z     at wrapSafe (internal/modules/cjs/loader.js:1054:16)
2022-11-24T13:14:57.076193Z     at Module._compile (internal/modules/cjs/loader.js:1102:27)
2022-11-24T13:14:57.0763Z       at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2022-11-24T13:14:57.076409Z     at Module.load (internal/modules/cjs/loader.js:986:32)
2022-11-24T13:14:57.076516Z     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2022-11-24T13:14:57.076621Z     at Module.require (internal/modules/cjs/loader.js:1026:19)
2022-11-24T13:14:57.076736Z     at require (internal/modules/cjs/helpers.js:72:18)
2022-11-24T13:14:57.076877Z     at Object.<anonymous> (/opt/buildhome/repo/node_modules/next/dist/cli/next-build.js:10:37)
2022-11-24T13:14:57.077002Z     at Module._compile (internal/modules/cjs/loader.js:1138:30)
2022-11-24T13:14:57.077111Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2022-11-24T13:14:57.082209Z Failed: build command exited with code: 1
2022-11-24T13:14:57.927713Z Failed: an internal error occurred

它导出文件并部署到云耀斑

neskvpey

neskvpey1#

您得到的错误表明您的节点版本不支持nullish coalescing operatornullish coalescing operator是节点版本14的一部分。通过阅读Cloudflare文档,我了解到默认节点版本是12,这与此怀疑相符。
解决方案是更新您的Cloudflare配置以使用较新版本(14+)的Node(请参阅文档)。

相关问题