Head-manager: TypeError: Cannot read property 'content' of null
See original GitHub issue<Head> seems to work as expected but I see this error in the console and it seems like coming from nextjs.
- if there is an error on my side, the error message should do a better job describing possible issues and hint what needs to be fixed
- if error is on nextjs side it should be fixed
tried to isolate the issue and find when it happens. I removed all the surrounding code from _app.js
class MyApp extends App {
render() {
return (
<div>
<InitialHead/>
#wefklj hi 123
</div>
);
}
}
and InitialHead works perfectly fine, it’s code:
import React from 'react';
import Head from 'next/head';
// import {NODE_ENV} from '../config';
// import Layout from 'components/Layout';
class InitialHead extends React.Component {
render() {
return (
<Head>
<title key={'title'}>Foo</title>
</Head>
);
}
}
export default InitialHead;
The title is updated to “Foo”
“next”: “^9.0.3”, macos 10.14.6 Chrome Version 76.0.3809.87 (Official Build) (64-bit)
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
"TypeError: Cannot read property 'content' of null" Running in ...
Solved, i ignored the errors. I have 2 more test suites who import the component, and missed document.head.innerHTML. Thank you :) – FlyOverDevs....
Read more >Uncaught TypeError: Cannot read property of null - iDiallo
You are accessing a property of an object that is null. For example, document.getElementById('stuff') returns null. So adding .value will cause ...
Read more >TypeError: Cannot read property 'value' of Null in JS
There are 2 main reasons the "Cannot read property 'value' of null" error occurs: Accessing the value property on a null value (DOM...
Read more >Uncaught TypeError cannot read property 'addeventlistener' of ...
In JavaScript, a very common error is the Uncaught TypeError Cannot read property 'addeventlistener' of null. This error occurs when JavaScript is not...
Read more >How To Fix Cannot Read Property 'style' of Null in JavaScript
A common error you might run into while trying to do this is Uncaught TypeError: Cannot read properties of null (reading 'style') ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please follow the issue template and provide a full reproduction.
the issue is that I didn’t add head to _document but _app and other places. It would be awesome if that error would provide a hint that it needs to be in _document only.
also, this definitely should be somewhere in the documentation: Question:
https://spectrum.chat/next-js/general/whats-the-difference-between-these-imports~548d0862-72a5-4980-ac58-55f4445bdee4