Gatsby-theme-novela: Cannot read property 'getElementsByTagName' of null

Created on 2 Feb 2020  路  13Comments  路  Source: narative/gatsby-theme-novela

Prerequisites

  • [x] Have you searched the issue tracker for similar issues (either past or present)?
  • [x] Can you reproduce the issue consistently?
  • [x] Are you reporting to the correct repository?
  • [ ] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.

Description

Creating a new Post in mdx format (local) on posts/2017-05-22-my-title an write the text. After
generating the start page shows the new entry. If i try to read the whole post i get the following error:

Cannot read property 'getElementsByTagName' of null

 if (document.title) {
  171 |   pageName = document.title
  172 | }
> 173 | const pageHeadings = document
  174 |   .getElementById(`gatsby-focus-wrapper`)
  175 |   .getElementsByTagName(`h1`)
  176 | if (pageHeadings && pageHeadings.length) {

Version of Novela you are using

1.0.0

Number of posts you have and which data source

  • [x] Local
  • [ ] Contentful

Describe the bug

Creating a new Post in mdx format (local) on posts/2017-05-22-my-title an write the text. After
generating the start page shows the new entry. If i try to read the whole post i get the following error:

Cannot read property 'getElementsByTagName' of null

 if (document.title) {
  171 |   pageName = document.title
  172 | }
> 173 | const pageHeadings = document
  174 |   .getElementById(`gatsby-focus-wrapper`)
  175 |   .getElementsByTagName(`h1`)
  176 | if (pageHeadings && pageHeadings.length) {

To Reproduce

Steps to reproduce the behavior:

  1. Create a new folder (posts/2020-02-02-my-new-blogpost
  2. write the text and save
  3. gatsby build the page
  4. after clicking the link to read the new blog post the above descripted error will show

Expected behavior

Just see the whole blogpost

Screenshots

_If applicable, add screenshots to help explain your problem._

Browser

all borwser (latest Chrome, Edge, and Firefox 72.0.2)

bug

Most helpful comment

update your gatsby version to 2.19.12 or latest. it will resolve.

All 13 comments

update your gatsby version to 2.19.12 or latest. it will resolve.

Thanks for your reply. But it doesn't work.

I installed Gatsby globaly and the version is

Gatsby CLI version: 2.8.29
Gatsby version: 2.19.12

the errors stays. I try also to the same with npx without success.

I'm seeing this error as well.

Gatsby CLI version: 2.8.29
Gatsby version: 2.19.12

After install with this theme starter, and enter the example post, same error happens

I think we should fix the version issue soon. Now more than 20% of issue cards are version issues.

To the writer, Can you try to update your version of gatsby in the "@narative/gatsby-theme-novela/package.json" file.

Also, I've updated the "React, React-dom" package.
And it builds without a problem.

Screen Shot 2020-02-10 at 11 29 06 AM

I had the same issue and fixed by giving a valid author in the demo post. My mistake was that I edited the authors but forgot to change the post data to reflect that.

Seeing this same issue on my repo but only on windows.

@eugenejeonme thx for your hint but it doesn't work for me. Im using Windows 10 Enterprise if tis necessary. Which OS are you using?

@eugenejeonme thx for your hint but it doesn't work for me. Im using Windows 10 Enterprise if tis necessary. Which OS are you using?

Hm... I use Mac OS (with Catalina version). But, I don't know if it has anything to do with the OS version.
I think it would be better to upgrade all the other packages.

Same error here. I use Windows 10. My packages versions are:
"gatsby": "^2.20.8",
"react": "^16.12.0",
"react-dom": "^16.12.0",

Also experiencing the same issue on the latest version but only after implementing createPages.

Also experiencing the same issue on the latest version but only after implementing createPages.

I have the same issue

Please check your author name. Is it exists in the authors' directory with author meta information? yes, then check the spelling.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SabariVig picture SabariVig  路  4Comments

eugenejeonme picture eugenejeonme  路  3Comments

zactony picture zactony  路  3Comments

KrisBraun picture KrisBraun  路  4Comments

MartinRosenberg picture MartinRosenberg  路  3Comments