• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

_document.js 관련 에러가 발생해여

19.12.17 00:28 작성 조회수 329

0

_document.js에 오타가 있는건지 다른데 오타가 있는건지

몰겠어여 알려주시면 감사여

Error: "MyDocument.getInitialProps()" should resolve to an object with a "html" prop set with a valid html string
    at Object.renderToHTML (C:\node_bird_44\front\node_modules\next\dist\next-server\server\render.js:338:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)
GET / 500 11240.415 ms - 21
[ event ] disposing inactive page(s): /, /_error

https://github.com/hyunsokstar/node_bird_44

답변 1

답변을 작성해보세요.

0

static async getInitialProps(ctx) {
  const initialProps = await Document.getInitialProps(ctx)
  return { ...initialProps, helmet: Helmet.renderStatic() }
}
여기서처럼 앞에 initialProps를 추가해보세요.