2020-08-24 04:42:51 +02:00
|
|
|
# Missing Document Components
|
|
|
|
|
|
|
|
#### Why This Error Occurred
|
|
|
|
|
|
|
|
In your custom `pages/_document` an expected sub-component was not rendered.
|
|
|
|
|
|
|
|
#### Possible Ways to Fix It
|
|
|
|
|
2020-09-12 19:39:16 +02:00
|
|
|
Make sure to import and render all of the expected `Document` components:
|
|
|
|
|
|
|
|
- `<Html />`
|
|
|
|
- `<Head />`
|
|
|
|
- `<Main />`
|
|
|
|
- `<NextScript />`
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
```tsx
|
|
|
|
import Document, { Html, Head, Main, NextScript } from 'next/document'
|
|
|
|
|
|
|
|
export default class MyDocument extends Document {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Html>
|
|
|
|
<Head />
|
|
|
|
<body>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</Html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2020-08-24 04:42:51 +02:00
|
|
|
|
|
|
|
### Useful Links
|
|
|
|
|
|
|
|
- [Custom Document Docs](https://nextjs.org/docs/advanced-features/custom-document)
|