错误:Minified React错误#321;在vercel上部署next.js项目时


Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at S (/vercel/path0/node_modules/react/cjs/react.production.min.js:18:327)
at Object.exports.useState (/vercel/path0/node_modules/react/cjs/react.production.min.js:23:277)
at SessionProvider (/vercel/path0/node_modules/next-auth/react/index.js:422:31)
at Wc (/usr/local/share/.config/yarn/global/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/usr/local/share/.config/yarn/global/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/usr/local/share/.config/yarn/global/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)

///app.js

import "../styles/globals.css";
import type { AppProps } from "next/app";
import Top from "@components/top";
import Footer from "@components/footer";
import { SessionProvider } from "next-auth/react";
import { SWRConfig } from "swr";
import { RecoilRoot } from "recoil";
import { Session } from "next-auth";
function MyApp({
Component,
pageProps: { session, ...pageProps },
}: AppProps<{
session: Session;
}>) {
return (
<SessionProvider session={session}>
<SWRConfig
value={{
fetcher: (url: string) =>
fetch(url).then((response) => response.json()),
}}
>
<RecoilRoot>
<div className=" min-w-[300px]  max-h-fit flex flex-col items-center min-h-[100vh] relative">
<Top />
<section className=" mt-10 mx-3 flex-column items-center pb-[60px]">
<Component {...pageProps} />
</section>
<Footer />
</div>
</RecoilRoot>
</SWRConfig>
</SessionProvider>
);
}

export default MyApp;

在部署时,几乎每个页面都会发生此错误。

我重新安装了npm,并检查我是否以错误的方式使用了钩子,但似乎不是。

有什么解决办法吗??

我只想知道错误发生在哪里。

尝试使用纱线:

yarn run build

我已经尝试使用下一个版本&npm运行build,但在我的情况下只有yarn有效!

在我的情况下,我不得不在next.config.js中将swcMinify:true更改为swcMinify:false

相关内容

  • 没有找到相关文章

最新更新