首頁  >  問答  >  主體

NextJs 未找到頁面每隔約 3 秒重新載入一次

<p>我正在關注這個 https://nextjs.org/docs/app/api-reference/file-conventions/not-found</p> <p>但一切正常,但未找到的頁面每秒都會重新載入。這是我的未找到頁面代碼</p> <pre class="brush:php;toolbar:false;">import Link from "next/link"; export default function NotFound() { return ( <div className="overflow-hidden bg-white text-black md:py-20"> <div className="container relative mx-auto px-4"> <div className="grid grid-cols-1 items-center px-4 py-20 xl:py-10"> <div> <h2 className="relative z-10 text-center text-6xl font-bold xl:text-9xl"> Oops! <br /> Page Not Found </h2> <span className="absolute left-0 top-0 w-full tr​​ansform whitespace-nowrap text-[250px] font-extrabold text-gray-400 opacity-40 blur-[2px] md:-left-[5% ] xl:text-[300px]"> ERROR 404 </span> <p className="mx-auto text-center text-base md:p-4 xl:w-2/3 xl:text-xl"> Don&apos;t worry, though! Our team of skilled developers is constantly working to enhance your browsing experience. In the meantime, feel free to explore our other amazing content and discover exciting insights. <br /> If you believe you&apos;ve reached this page in error, please double-check the URL or use the navigation links to find your way back to our website&apos;s main sections. </p> </div> </div> </div> </div> ); }</pre></p>
P粉054616867P粉054616867386 天前367

全部回覆(1)我來回復

  • P粉964682904

    P粉9646829042023-09-01 12:24:29

    這是 Next.js 中的已知錯誤,已在 GitHub 上報告。顯然,它只發生在開發模式(npm run dev)期間,但在生產模式(npm run build && npm start)中沒有問題。

    我注意到您正在使用

    Link 元件,即 可能是問題

    因此,刪除

    import Link from "next/link"; 應該會使其適合您,因為您沒有使用它。

    有些人也

    報告使用turbopack修復了這個問題也是如此。

    回覆
    0
  • 取消回覆