Gatsby: navigation.js:173 Uncaught TypeError

Created on 2 Feb 2020  路  26Comments  路  Source: gatsbyjs/gatsby

Updated my packages today and started getting this error when i click a link on my webpage.

navigation.js:173 Uncaught TypeError: Cannot read property 'getElementsByTagName' of null
    at navigation.js:173

  170 | 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) {
bug

Most helpful comment

Fixed and published in [email protected]

Apologies for this.

All 26 comments

Same here

Appears to have been introduced in this commit:
https://github.com/gatsbyjs/gatsby/commit/701222f76fbfe61bf4a519c5105baf91272cd221

Reverting my Gatsby version to 2.18.24 seemed to resolve the crash, though I'm having issues with pages not loading any data when you click a gatsby link. Can't win 'em all I guess

Just started hitting this too.

Same here, cc @madalynrose.

I confirm to have hit this issue after upgrading to the latest 2.19.11 release.

Fix incoming

Im having the same issue :(

Same here!

Experiencing the same issue :<

Same here

Fixed and published in [email protected]

Apologies for this.

I seem to be getting this exact issue even after updating Gatsby to 2.19.12

Try rm -rf node_modules/
make sure you have the latest version and install again
The issue is with @reach/router: 1.3.0
So you want to make sure you have "@reach/router": "1.2.1"

checked for both reach/router and gatsby versions in the dependencies, then removed node_modules and re-installed

still getting the error

Same error for me, I have 2.19.12 and @reach/router: 1.2.1, blown away node_modules and everything else associated with my project and the error is still occurring.

Yea same issue for me, interestingly my project works fine until I start using Gatsby Image, then the problem occurs on my homepage only /pages/index

Same issue. Was working fine until I start using MDXRenderer (gatsby-plugin-mdx)

Having the same issue

Having the same issue appear on a specific set of pages. Same code works fine on a Mac but not on my Windows machine. Tried different versions of Gatsby.

Having the same issue, "gatsby": "^2.19.19".

Edit: I fixed it. My components filename was "Search.js" and route was navigate("/search"). Renamed my file to search.js and it started working.

Same issue "gatsby": "^2.19.12". Any work arounds as my Link is totally dead?

The original issue was solved and the reproduction steps mentioned here cannot reproduce it anymore. If you have further problems you can take a look at https://github.com/gatsbyjs/gatsby/issues/21263 so that we don鈥檛 have duplicate issues. Thanks!

Having the same issue, "gatsby": "^2.19.19".

Edit: I fixed it. My components filename was "Search.js" and route was navigate("/search"). Renamed my file to search.js and it started working.

I rename the file in page from Cart.js to cart.js. It works. Thank you.

I try all the steps above but i still getting this issue D:, rename files to lowercase, put all files in the src/pages root, using gatsby clean and also deleting node_modules and yarn.lock, i don`t know what more can i do to solve this, someone have a diferent way?

still 100% getting this error

Just started running into this issue as well

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timbrandin picture timbrandin  路  3Comments

benstr picture benstr  路  3Comments

andykais picture andykais  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

brandonmp picture brandonmp  路  3Comments