# 에러 해결 방법

1. 서버 컴포넌트 빌드 에러

```bash
# pnpm run build
Error: Dynamic server usage: Route /product/create couldn't be rendered statically because it used `cookies`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
    at v (.next/server/chunks/943.js:46:18951)
    at d (.next/server/chunks/726.js:1:46755)
    at <unknown> (.next/server/chunks/835.js:1:20108)
    at async aD.request (.next/server/chunks/726.js:3:21187)
    at async a (.next/server/app/product/create/page.js:1:5338) {
  description: "Route /product/create couldn't be rendered statically because it used `cookies`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error",
  digest: 'DYNAMIC_SERVER_USAGE'
}
```

* 빌드 시 위와 같은 에러가 발생할 경우 에러 메시지 상의 Route 경로의 페이지 파일을 찾아 파일 최상단에 아래 코드 추가

```typescriptreact
export const dynamic = 'force-dynamic' // 페이지를 강제로 동적 렌더링으로 설정
```



2.  use client 에러

    <figure><img src="https://3212561211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FojaIWzOttDuV549cYsPQ%2Fuploads%2FmB8BeULBwvRIcGnHWFWY%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202025-04-04%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%202.59.37.png?alt=media&#x26;token=78078e57-f77e-4418-a425-e0e243293e92" alt=""><figcaption></figcaption></figure>

* 에러가 발생한 컴포넌트 최상단에 'use client' 코드 추가

<figure><img src="https://3212561211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FojaIWzOttDuV549cYsPQ%2Fuploads%2FEqKZdIPtqjHuvr8yDlVA%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202025-04-04%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%203.30.32.png?alt=media&#x26;token=9e537567-7d49-4ea6-a467-b9ef779072ba" alt=""><figcaption></figcaption></figure>
