Vercel上的预渲染错误,下载Nextjs 13.4

pw9qyyiw  于 2023-05-17  发布在  其他
关注(0)|答案(1)|浏览(140)

我的网站在Nextjs 13.3.4上运行良好,但当我将其更新到Nextjs 13.4.0时,我遇到了预渲染问题。我试着找到一个特定的页面,这是导致问题,但从字面上所有的页面未能得到预先呈现。此问题仅发生在vercel控制台上。当我在本地运行“yarn run build”时,输出是正常的。

Error occurred prerendering page "/careers/content-specialist". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useRef')
    at exports.useRef (/vercel/path0/node_modules/react/cjs/react.production.min.js:25:337)
    at y (file:///vercel/path0/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js:1:178)
    at Ke (file:///vercel/path0/node_modules/@headlessui/react/dist/components/listbox/listbox.js:1:4762)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:118:245)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at He (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:123:155)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:215)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
TypeError: Cannot read properties of null (reading 'useRef')
    at exports.useRef (/vercel/path0/node_modules/react/cjs/react.production.min.js:25:337)
    at y (file:///vercel/path0/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js:1:178)
    at Ke (file:///vercel/path0/node_modules/@headlessui/react/dist/components/listbox/listbox.js:1:4762)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:118:245)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at He (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:123:155)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:215)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
    at Ge (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:9)
    at Z (/vercel/path0/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)

更新nextjs 13.3.4nextjs 13.4.0尝试删除所有无头UI内容,相同错误。

y4ekin9u

y4ekin9u1#

使用Next.js版本13.4.2及以上,不会出现此问题。

相关问题