Vercel - Deployment has failed

육희영·2024년 4월 2일

회고록

목록 보기
24/24

next tailwind mongodb를 이용한 문제은행 사이트 제작중(깃:jlptn1)
next 다중 동적 라우팅을 하니 아래 오류가 뜨면서 Vercel 배포가 계속 실패했는데

[오류]
vercel Failed to compile.
src/app/layout.tsx
Type error: Type '{ children: ReactNode; }' does not satisfy the constraint 'LayoutProps'.
Property 'types' is missing in type '{ children: ReactNode; }' but required in type 'LayoutProps'.
Error: Command "npm run build" exited with 1

[해결 방법]
1.RootLayout에 types: string[];를 추가했더니 되었다.
2.npm run build에 있는 오류를 없애기

1번 해보고 안되면 2번까지 해야 한다.

use client';
import React from "react";
import { SessionProvider } from "next-auth/react";

interface LayoutProps {
    children: React.ReactNode;
    types: string[];
}
export default function RootLayout({ children }: LayoutProps) {
    return (
        <html lang="ja">
        <head>
            <meta name={'viewport'} content="width=device-width,initial-scale=1.0"/>
            <meta charSet="Shift_JIS"/>
            <meta httpEquiv="X-UA-Compatible" content="IE=edge"/>
            <title>日本語能力試験勉強</title>
        </head>
        <body>
        <SessionProvider>
            {children}
        </SessionProvider>
        </body>
        </html>
    );
}

0개의 댓글