我一整天都在尝试将我的 next.js 应用程序部署到 Vercel。该应用程序在开发模式下运行良好,我也可以在我的机器上进行构建,但是当我部署到 Vercel 时它会失败。 我尝试了所有我能找到的变化,但都没有成功。这是现在的样子:
const dev = process.env.NODE_ENV === 'development';
export const server = dev ? 'http://localhost:3000' : `https://${process.env.VERCEL_URL}`;
export async function getStaticProps(): Promise<{ props: ProjectsProps }> {
const response = await fetch(`${server}/api/github`);
const { stars, repos, followers } = await response.json();
return { props: { stars, repos, followers, revalidate: 600 } };
}
export default Projects;
以及我得到的错误: