Gatsby: Gatsby not loading pages

Created on 18 Dec 2018  路  11Comments  路  Source: gatsbyjs/gatsby

Description

I cannot transit to another page, Gatsby only loads one page.

Steps to reproduce

  1. First create a page index.js
  2. Second create a page about.js
  3. Start the dev server
  4. Open the navigator on localhost:8000 and try to navigate to /about/

Expected result

The about page loaded

Actual result

The won't load

Environment

System: OS: OS X El Capitan 10.11.6 CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz Shell: 5.0.8 - /bin/zsh Binaries: Node: 10.14.2 - /usr/local/bin/node Yarn: 1.12.3 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Browsers: Chrome: 71.0.3578.98 Safari: 9.1.2 npmPackages: gatsby: ^2.0.33 => 2.0.70 gatsby-plugin-typography: ^2.2.2 => 2.2.2 npmGlobalPackages: gatsby-cli: 2.4.6

confirmed

Most helpful comment

I discovered what was wrong, for any reason, the Gatsby actually only works if each page has a unique identifier name such as const Index = () => <div>Home</div>, and will not work if have two pages exporting something like export default () => <div>Home</div> and export default () => <div>About</div>, well is it.

All 11 comments

I discovered what was wrong, for any reason, the Gatsby actually only works if each page has a unique identifier name such as const Index = () => <div>Home</div>, and will not work if have two pages exporting something like export default () => <div>Home</div> and export default () => <div>About</div>, well is it.

I came across this issue trying to follow the tutorial https://www.gatsbyjs.org/tutorial/part-three/

I suppose that this is an issue that has recently been introduced.

@valtism @kaluabentes you're both correct.

I believe gatsbyjs/gatsby#10455 introduced a regression with develop mode regarding anonymous arrow functions.

I've created a reproduction of the issue here.

You can reproduce the issue by checking out that repo and running yarn start or npm start. You'll see the About page not the index route in develop mode.

If you run yarn add [email protected] (or npm i [email protected] --save) and re-run yarn develop the issue will go away.

I think we'll need to get a fix out early tomorrow morning or perhaps consider reverting that PR for the time being.

Thanks for bringing this to our attention!

Let me take a look from HotLoader prospective.

The issue is on Gatsby side. I'll comment on PR

@kaluabentes - try remove yarn.lock and then reinstall package. That would eventually update React-Hot-Loader from 4.6.1 to 4.6.2 and fix the problem.

Thank you guys for the feedback, the problem its already resolved using the method of naming identifiers and exporting them, Its nice to help improve Gatsby, congrats, its a nice tool.

@theKashey little confused; updating to 4.6.2 seems to do the trick (for me, at least). Is there more we should do from Gatsby's side, e.g. your comment in https://github.com/gatsbyjs/gatsby/pull/10455#issuecomment-448101330

If it's just a matter of bumping, I'll get a PR up bumping the minimum version in gatsby core and get this issue closed out 馃憣

The fix is available in [email protected]

To upgrade (and ensure no issue, even if using anonymous arrow functions) just explicitly install _at least_ the above version, e.g.

yarn add gatsby@^2.0.71

or

npm install gatsby@^2.0.71 --save

with ver. 2.0.73 hrm is not working, reverted back to 2.0.68 right now.

@pungggi can you provide more info? Seems to work just fine to me.

Do you perhaps have a lockfile that is pinning versions?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cusspvz picture cusspvz  路  128Comments

OleksandrSachuk picture OleksandrSachuk  路  75Comments

KyleAMathews picture KyleAMathews  路  97Comments

jonathan-chin picture jonathan-chin  路  69Comments

jp887 picture jp887  路  98Comments