본문 바로가기
코딩이야기/트러블슈팅

[Next.js] build할 때 checkFields<Diff<LayoutProps, FirstArg<TEntry['default']>, 'default'>>() 오류 기록

by TaeHyeon0412 2024. 4. 18.

문제상황

next.js 프로젝트 빌드 과정에서 빌드가 안되는 오류가 발생하였습니다. 

 

해결과정

아무리 구글링을 해도 오류에 대한 원인이 분명하게 나오지 않아서 
github의 next.js에  Discussions 부분에 동일한 문제가 있나 살펴보았습니다.

빌드 시 이런 오류가 뜨면 
app의 page중에 같은 이름으로 된 파일이 있는지 확인 해야 됩니다.
이 오류가 뜬 이유가 components의 layout.tsx와 app의 layout.tsx가 똑같은 이름으로 export 되어 충돌이 일어나서 생긴 오류였습니다.
components의 layout을 layout-bar로 이름을 변경하니 오류가 사라졌습니다.

참고 : NextFont gives a type error on Build mode · vercel/next.js · Discussion #58693 · GitHub

 

NextFont gives a type error on Build mode · vercel next.js · Discussion #58693

Summary When I run a build, I encounter the following TypeScript error : .next/types/app/layout.ts:8:13 Type error: Type 'OmitWithTag<typeof import("C:/Users/oussama/Desktop/LEARN/freelancer_dash/a...

github.com