V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
mayunyi
V2EX  ›  Next.js

关于 nextjs13app 使用 getData 获取数据,打包报错

  •  
  •   mayunyi · Nov 22, 2023 · 1683 views
    This topic created in 888 days ago, the information mentioned may be changed or developed.

    async function getData() { const response = await request.get("/protocol/legal", {status: 2}); if (response.code !== 0) { throw new Error('Failed to fetch data') } return response.data.content; }

    const Legal = async () => { const content = await getData();

    return(<div>....</div>)
    

    }

    打包报错信息如下: Error occurred prerendering page "/protocol/legal". Read more: https://nextjs.org/docs/messages/prerender-error

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5879 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 02:48 · PVG 10:48 · LAX 19:48 · JFK 22:48
    ♥ Do have faith in what you're doing.