본문 바로가기
오류

[nextjs 14] Export encountered errors on following paths: 오류 해결

by 개발고구마 2025. 2. 8.

nextjs 14에서

import { useSearchParams } from 'next/navigation';

사용하게 됐을 때 아래와 같은 에러가 났다

로컬
Export encountered errors on following paths:

vercel
⨯ useSearchParams() should be wrapped in a suspense boundary at page "/main/artist". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout

 

문제는 파라미터로 동적으로 페이지를 불러올때는
하위 페이지를 불러올 때 정적 페이지 /page가 아닌 값으로 불러와야한다

나는 id로 값을 넘기고 있으니 "[id]" 와 같은 페이지로 만들어야한다

해결 방법

기존

변경

재빌드 했을 때 오류 안나는거 확인
(원래 artist , detail이 있었는데 비교를위해 artist는 변경하지않고 남겨둠)

 

 

nextjs 기초 배울때 배웠던 내용인데 까먹었었다...

막상 오류를 접하니까 배운대로 쓰게 됐다