strapi / strapi-starter-gatsby-corporate

strapi-starter-gatsby-corporate-git-main-strapijs.vercel.app
MIT License
27 stars 8 forks source link

Multiple root queries prevent compiling frontend #5

Closed yakou32 closed 3 years ago

yakou32 commented 3 years ago

I just performed a brand new clone and followed the quickstart.

http://localhost:1337/admin/ launches, and Strapi is fully accessible.

However, there is a compilation error on Gatsby, and http://localhost:8000/ shows a compile error:

Multiple "root" queries found: "DynamicPageQuery" and "DynamicPageQuery". Only the first ("DynamicPageQuery") will be registered.

Instead of:

   1 | query DynamicPageQuery {
   2 |   strapi {
   3 |     #...
   4 |   }
   5 | }
   6 |
   7 | query DynamicPageQuery {
   8 |   strapi {
   9 |     #...
  10 |   }
  11 | }

Do:

  1 | query dynamicPageQueryAndDynamicPageQuery {
  2 |   strapi {
  3 |     #...
  4 |   }
  5 |   strapi {
  6 |     #...
  7 |   }
  8 | }

This can happen when you use two page/static queries in one file. Please combine those into one query. If you're defining multiple components (each with a static query) in one file, you'll need to move each component to its own file.

File: .../frontend/src/templates/page.js

I'm not skilled enough to correct the page.js file by myself...

remidej commented 3 years ago

Can you share when you downloaded the starter? This looks like a bug we fixed about a week ago. If you installed it before that, I'd recommend recreating the project entirely if you don't want to correct the bugs manually

yakou32 commented 3 years ago

I just downloaded the starter yesterday evening...

remidej commented 3 years ago

I just tried it using the create-strapi-starter command from the readme. It's working fine on my end.

Can you try re-installing the project using the same CLI? If it works, that would help us narrow down the issue

yakou32 commented 3 years ago

Yes, I retried and it worked fine. I don't know what happened. Sorry for the issue, I guess I should have retried first... (and that's great to have this starter!!!)

remidej commented 3 years ago

Thanks, I guess it could be some kind of cache issue with create-strapi-starter. We'll look into it