相关疑难解决方法(0)

为什么 Vercel 无法构建我的 Next.js tsx 应用程序?

当我在本地计算机上运行 npm run build 和 npm start 时,它完美地部署到本地主机,但是当我尝试将完全相同的代码部署到 Vercel 时,出现以下错误:

08:28:16    Failed to compile.
08:28:16    ./pages/index.tsx:5:20
08:28:16    Type error: Cannot find module '../components/layout' or its corresponding type declarations.
Run Code Online (Sandbox Code Playgroud)

这绝对看起来像布局组件的问题,我改变了重要的顺序,并且在尝试加载布局组件时总是失败。这是该组件的代码:

import Alert from "./alert";
import Footer from "./footer";
import Meta from "./meta";

type Props = {
  preview?: boolean;
  children: React.ReactNode;
};

const Layout = ({ preview, children }: Props) => {
  return (
    <>
      <Meta />
      <div className="min-h-screen">
        <Alert preview={preview} />
        <main>{children}</main>
      </div>
      <Footer />
    </>
  );
};

export default Layout; …
Run Code Online (Sandbox Code Playgroud)

next.js vercel

1
推荐指数
1
解决办法
2154
查看次数

标签 统计

next.js ×1

vercel ×1