-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
navigation.js:173 Uncaught TypeError #21263
Comments
Hi there, I got this to work with the latest Gatsby version by deleting the |
The problem persists for me in my environment. I've deleted both node_modules and package-lock.json, reinstalled, and checked the dependencies. I've noticed gatsby-link still requires @reach/router 1.2.6 whereas gatsby requires 1.2.1. I'm not sure how relevant that is because the bug persists whether I important Link from gatsby, gatsby-link, or @reach/router. Interesting if I build and serve, when I first try to load the link, it works, but afterwards I get the error in the devtools console. If there's any other information I could provide, I'd be happy to |
@garrison0 what is the file name that you are using for the new page? Are you sure it matches that path that you are linking to? For example, did you make a |
that fixed the problem, thanks but why wouldn't something like this work? :
|
Looks like the issue here is that page paths are case sensitive and hence it isn't able to find your page and breaks at this confusing spot (because it tries to announce the route change). We should catch that before attempting this and redirect to 404. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
I had similar problem as @garrison0 and I fixed it by following these instructions: https://www.gatsbyjs.org/docs/client-only-routes-and-user-authentication/#configuring-pages-with-matchpath |
I've experienced the same issue, but only with some links. After trying a number of things I found it was only an issue with url paths with a capital letter in them. As soon as I switch them all lowercase they work fine. |
Okay ... I managed to fix it for me. I had pages which were created with slugified paths, however some of my links were pointing to un-slugified paths of the pages. Theoretically this should have just returned a 404 Page not Found however instead it threw this error. Resolved for me now though. |
Having a similar issue, I am using Gatsby-Image, and reloading or hot reloads crash with the error. How would I go about reverting to the correct version of @reach/router ? I have Gatsby installed, but no @reach/router in my |
Having the same issue using the same starter template. For me, removing the line -- EDIT -- |
I'm having the same issue but on the index.js page. When running Gatsby Develop I get the navigation.js error. Every other page is fine. Seems to only happen when I use Gatsby Image/image sharp. |
I'm having the same issue on certain page. There doesn't seem to be much difference between the pages. Also using image sharp upd: I solved my issue. I found there was a Hint: I debugged this by running build (since the build was mostly correct and resulted minor error). Manually opening the corresponding html and in the console it told me that I had two strange things as key and there were duplicate(?? while actually it is not duplicate, but the problem was indeed in the keys) |
Had the same issue, not a Gatsby issue I guess:
In my case it was a SwiperJS Instance that was removed between pages, and that was causing the error. I read that some people installed some plugins and libraries and got the error, so I figured that my Swiper (but other libraries too) could bring the error. Hope it helps you guys. |
Any update on this please? still getting the same issue using |
Still getting this error too. Update: |
I am also getting the same error on [email protected] It appears to be when a is being used by one of my antd components. I can't remove these easily as they have been integral to my application. Also, the error seemed to pop out of nowhere. One second it was working, the next not. I have cleared the cache, removed node_modules & lock file. Not sure where to go from here. |
I've been getting this error too trying to create dynamic client-side routes using Reach Router (fixed to version 1.2.1 to address other comments in this thread. I pushed #23196 as a potential fix to this nullcheck. |
I had this issue, and nothing else worked until I found out that slugs are formatted
Which when you link to this page it will resolve to |
This issue will be closed with this pull request #23196 |
* Add null check to address #21263 #21263 is an issue many people are arriving at for a variety of reasons. Since the code contains this logic on the following line: ``` if (pageHeadings && pageHeadings.length) { ``` There should be no issue in seeing if `document.getElementById(`gatsby-focus-wrapper`) exists first before attempting to look up `getElementsByTagName`. * Update packages/gatsby/cache-dir/navigation.js Co-Authored-By: Vladimir Razuvaev <[email protected]> * chore: format Co-authored-by: Vladimir Razuvaev <[email protected]> Co-authored-by: gatsbybot <[email protected]>
* fix(gatsby): Throw error on default export in gatsby-ssr/brows… (#23133) * fix: Handle default export case * heh * fix comment * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * fix(docs): Using-MDX link (#23288) * fix(docs): Link to apollo blog (#23290) * fix(docs): change gatsby-config mention for global CSS import (#23245) * fix `gatsby-config` mention * chore: format Co-authored-by: gatsbybot <[email protected]> * docs: added details signifying that node fields can be arbitra… (#23106) * added details signifying that node fields can be arbitrary * Update docs/docs/data-fetching.md Co-Authored-By: Kyle Gill <[email protected]> * Update docs/docs/data-fetching.md Co-Authored-By: Kyle Gill <[email protected]> * removed empty line to fix failed linting tests Co-Authored-By: Kyle Gill <[email protected]> Co-authored-by: Kyle Gill <[email protected]> * chore(gatsby): drop the the (#23295) * chore(showcase): Add new sites built by Bejamas to showcase; c… (#23125) * chore(sites): add new sites built by bejamas * chore(creators): update bejamas cover * chore(showcase):Add SofaScore Corporate web to showcase sites (#23128) Co-authored-by: Mario Nikolaus <[email protected]> * fix local links (#23149) * chore(docs): Reference new ComponentModel component rather than generic LayerModel (#23241) * Reference new ComponentModel component rather than generic LayerModel * Remove use of t macro from layer models * Half-fixing lingui code * Revert "Half-fixing lingui code" This reverts commit 64f052a. * Remove Lingui from layer-model * fix(www): fix sidebar (#23301) * fix(www): fix sidebar * Update sidebar.js * fix(recipes): Fix shadow-file resource for scoped NPM packages & re-enable e2e testing for resources (#23274) * fix(recipes): Fix shadow-file resource for scoped NPM packages * WILL SLASH FIX WINDOWS??? * Add missing code block * Try again * hmmm joinPath maybe is the problem * More fixes * try reenabling tests * disable colors in diffs * Fix npm script test * Why do these keep changing all the time?? * Use parsed value for the plan * Disable Chalk colors on unit tests so match local ones * Update packages/gatsby-recipes/src/providers/utils/get-diff.js Co-Authored-By: John Otander <[email protected]> Co-authored-by: John Otander <[email protected]> Co-authored-by: gatsbybot <[email protected]> * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * chore(starters): add gatsby-starter-ecommerce (#23037) * chore(starters): add gatsby-starter-ecommerce * chore(starters): add gatsby-starter-ecommerce Co-authored-by: gatsbybot <[email protected]> * Add site Interficie Internet Services (#23130) * Add site Interficie Internet Services * Correct JavaScript cammelcase * Prettier format Co-authored-by: Obinna Ekwuno <[email protected]> Co-authored-by: gatsbybot <[email protected]> * fix brand names (#23142) * fix(blog): remove local domain (#23141) * fix remove local domain * fix local domain * fix local domain * fix remove local domain * fix for linter * Create paul scanlon 100 days of Gatsby blog post and add assets (#23294) * Create paul scanlon 100 days of Gatsby blog post and add assets * fix frontmatter * fix frontmatter issue and ad relative links * fix typos and spacing issues * Update docs/blog/2020-04-20-paulie-scanlons-journey-of-100-days/index.md Co-Authored-By: LB <[email protected]> Co-authored-by: Laurie Barth <[email protected]> Co-authored-by: LB <[email protected]> * Clarify prefix-paths variable. (#23309) The line (one line, two places) I'm editing was copied from a comment in #21627 without the surrounding context. This edit provides that context. Co-authored-by: gatsbybot <[email protected]> * chore(showcase):Add shreysachdeva.tech to showchase (#23032) * Add shreysachdeva.tech to sites.yml **Description** Added the details of my personal website shreysachdeva.tech. **Documentation** No documentation **Related Issues** N/A * chore: format Co-authored-by: gatsbybot <[email protected]> Co-authored-by: Obinna Ekwuno <[email protected]> * fix(www): Fix sidebar expansion behavior (#23325) * [gatsby-plugin-manifest] Generate a 32x32 favicon instead of generating from first manifest icon (#23077) * Decouple favicons from manifest icons * Update packages/gatsby-plugin-manifest/README.md * Replace include_favicon undefined check with nullish coalescing operator Co-Authored-By: Alex Moon <[email protected]> * Assert gatsby-plugin-manifest generates favicon PNG (unless include_favicon option is false) * Don't mock createContentDigest in gatsby-plugin-manifest's gatsby-ssr tests (to be consistent with gatsby-node tests) * Tweak a comment Co-authored-by: LB <[email protected]> Co-authored-by: Alex Moon <[email protected]> * Use mutations in Gatsby Admin * Remove stray console.logs * chore(gatsby-recipes): Update README typo (#23333) Fixed typo in README.md * fix(gatsby): Check for files before delete action when using GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES (#23219) * Check for files before delete action * fix lint issues * fix lint issues and add return type to checkFolderHasContent * rename check function Co-authored-by: gatsbybot <[email protected]> * Install plugins as prod dependencies * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * Add Besoegsvenner site to showcase (#23172) * Add Besoegsvenner site to showcase 50.000 elderly people in Denmark feel lonely. This project seeks to inform people to become visitor friends ("Besøgsven" in Danish) to help fight loneliness and bring new friendships in to the world. * Update sites.yml Co-authored-by: Obinna Ekwuno <[email protected]> Co-authored-by: gatsbybot <[email protected]> * chore(benchmarks): Add Drupal data updater script to update benchmark data (#23242) * Add Drupal data updater script to update benchmark data * Remove console.log statement Co-authored-by: gatsbybot <[email protected]> * Make TypeScript happy * fix(gatsby): fix Uncaught TypeError in navigation.js (#23196) * Add null check to address #21263 #21263 is an issue many people are arriving at for a variety of reasons. Since the code contains this logic on the following line: ``` if (pageHeadings && pageHeadings.length) { ``` There should be no issue in seeing if `document.getElementById(`gatsby-focus-wrapper`) exists first before attempting to look up `getElementsByTagName`. * Update packages/gatsby/cache-dir/navigation.js Co-Authored-By: Vladimir Razuvaev <[email protected]> * chore: format Co-authored-by: Vladimir Razuvaev <[email protected]> Co-authored-by: gatsbybot <[email protected]> * Add support for file argument in remark plugins for gatsby-plugin-mdx (#21489) * chore(gatsby-cli) Migrate remaining files in reporters/logger/ink to Typscript (#22782) * Migrate remaining files in gatsby-cli/reporters/logger/ink to TS * Rename "IProps" to something more contextual Extend interface parameter individually instead of using utility * Clean up after merging the redux master changes Co-authored-by: Blaine Kasten <[email protected]> * Fix Drupal data update script (#23349) * Add noop data update scripts for all benchmarks (#23352) * Add noop data update scripts for all CMS benchmarks * Add data update to remainder of benchmarks * chore(babel-preset-gatsby): Convert dependencies to TS (#22038) Co-authored-by: Blaine Kasten <[email protected]> * fix(gatsby): Improve error message when calling useStaticQuery without graphql (#23189) * Add warning message for a long queries (#23261) * Add warning message for a long queries * Change timeout to 15 seconds * Replace console with report * Print out queryJob.componentPath instead of page.internalComponentName * Add new info in the warning message Co-authored-by: gatsbybot <[email protected]> * refactor(gatsby): Convert inference metadata to TypeScript (#23264) * refactor(inference-metadata): Convert to TypeScript * Remove unused variable * Forgot some types * refactor(type-conflict-reporter): Node description After tightening the original util function to return a string only, it seemed sensible to convert that to use nullish coalescing. At that point, seeing the function is only used in a single place and not exported, I inlined it. * refactor(inference-metadata): Interface renaming * fix: Extract ValueType type * refactor: Change type from unknown to object * Corrected types, but left the code alone * Removed redundant comments * Update README.md (#23357) * feat(gatsby-remark-images): support markdownCaptions in mdx + fix for remark (#21188) * pass compiler to gatsby-remark-* plugins in the mdx plugin * make getImageCaption async * use async mdx compiler * fix for using compiler * don't mutate the node multiple times * convert markdown ast to html ast Co-authored-by: vladar * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * Fix lint errors * Fix TypeScript unused declaration error * Fix linting Co-authored-by: Lennart <[email protected]> Co-authored-by: Jeremy Albright <[email protected]> Co-authored-by: gatsbybot <[email protected]> Co-authored-by: Elijah <[email protected]> Co-authored-by: Kyle Gill <[email protected]> Co-authored-by: Peter van der Zee <[email protected]> Co-authored-by: Michał Zieliński <[email protected]> Co-authored-by: Mario Nikolaus <[email protected]> Co-authored-by: Mario Nikolaus <[email protected]> Co-authored-by: Michael <[email protected]> Co-authored-by: Aisha Blake <[email protected]> Co-authored-by: Ward Peeters <[email protected]> Co-authored-by: Kyle Mathews <[email protected]> Co-authored-by: John Otander <[email protected]> Co-authored-by: Lorenzo GM <[email protected]> Co-authored-by: aperacaula <[email protected]> Co-authored-by: Obinna Ekwuno <[email protected]> Co-authored-by: Michelle Gienow <[email protected]> Co-authored-by: Laurie Barth <[email protected]> Co-authored-by: LB <[email protected]> Co-authored-by: Alex Fornuto <[email protected]> Co-authored-by: Shrey Sachdeva <[email protected]> Co-authored-by: Nat Alison <[email protected]> Co-authored-by: Owen <[email protected]> Co-authored-by: Alex Moon <[email protected]> Co-authored-by: Marcus Lyons <[email protected]> Co-authored-by: Stuart Rayson <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: Jacob Packert <[email protected]> Co-authored-by: Shane Thomas <[email protected]> Co-authored-by: nick shook <[email protected]> Co-authored-by: Vladimir Razuvaev <[email protected]> Co-authored-by: Kai Hao <[email protected]> Co-authored-by: Arthur <[email protected]> Co-authored-by: Blaine Kasten <[email protected]> Co-authored-by: Nicholas Duffy <[email protected]> Co-authored-by: Michaël De Boey <[email protected]> Co-authored-by: Rebenkov Aleksey <[email protected]> Co-authored-by: Ross Hendry <[email protected]> Co-authored-by: Khaled Garbaya <[email protected]> Co-authored-by: Mathieu Dutour <[email protected]> Co-authored-by: Sidhartha Chatterjee <[email protected]>
Still getting this error from links after updating to Gatsby 2.19.12. I've checked my dependencies and re-installed node modules.
I can recreate this issue by:
See this previously closed issue, seems other people are still running into this aswell
The text was updated successfully, but these errors were encountered: