File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # ` next-head-count ` is missing
2+
3+ #### Why This Error Occurred
4+
5+ You have a custom ` pages/_document.js ` that doesn't have the components required for Next.js to render correctly.
6+
7+ #### Possible Ways to Fix It
8+
9+ Ensure that your ` _document.js ` is importing and rendering all of the [ required components] ( https://nextjs.org/docs#custom-document ) .
10+
11+ In this case you are most likely not rendering the ` <Head> ` component imported from ` next/document ` .
Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ export default class HeadManager {
4747 updateElements ( type , components ) {
4848 const headEl = document . getElementsByTagName ( 'head' ) [ 0 ]
4949 const headCountEl = headEl . querySelector ( 'meta[name=next-head-count]' )
50+ if ( process . env . NODE_ENV !== 'production' ) {
51+ if ( ! headCountEl ) {
52+ console . error (
53+ 'Warning: next-head-count is missing. https://err.sh/next.js/next-head-count-missing'
54+ )
55+ return
56+ }
57+ }
58+
5059 const headCount = Number ( headCountEl . content )
5160 const oldTags = [ ]
5261
You can’t perform that action at this time.
0 commit comments