rohitguptab / OneShopper

This is repository create for Ecommerce site With Gatsby js
https://oneshopper.netlify.com
MIT License
90 stars 59 forks source link

gatsby develop error #15

Closed huynhpeter closed 4 years ago

huynhpeter commented 4 years ago

Getting the following error when trying to start the project using gatsby develop command.

I've made sure to set all the .env variables as well as imported the oneshopper.json into my contentful space. I'm relatively new to graphql but not javascript & react.

I'm currently running on macos.

➜  bootstrap-ecommerce git:(master) ✗ gatsby develop
success open and validate gatsby-configs - 0.022s
success load plugins - 0.433s
success onPreInit - 0.004s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's no stale data.
success initialize cache - 0.016s
success copy gatsby files - 0.030s
success onPreBootstrap - 0.009s
success createSchemaCustomization - 0.006s
Starting to fetch data from Contentful
Fetching default locale
default locale is : en-US
contentTypes fetched 5
Updated entries  0
Deleted entries  0
Updated assets  0
Deleted assets  0
Fetch Contentful data: 220.128ms
success source and transform nodes - 0.366s
success building schema - 0.286s

 ERROR #85923  GRAPHQL

There was an error in your GraphQL query:

Cannot query field "allContentfulProduct" on type "Query".

If you don't expect "allContentfulProduct" to exist on the type "Query" it is most likely a typo.
However, if you expect "allContentfulProduct" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "allContentfulProduct" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: gatsby-node.js:5:10

 ERROR #85923  GRAPHQL

There was an error in your GraphQL query:

Cannot query field "allContentfulBlogs" on type "Query".

If you don't expect "allContentfulBlogs" to exist on the type "Query" it is most likely a typo.
However, if you expect "allContentfulBlogs" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "allContentfulBlogs" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: gatsby-node.js:5:10

 ERROR #11321  PLUGIN

"gatsby-node.js" threw an error while running the createPages lifecycle:

Cannot read property 'allContentfulProduct' of undefined

  30 |           reject(result.errors)
  31 |         }
> 32 |         result.data.allContentfulProduct.edges.forEach(edge => {
     |                     ^
  33 |           createPage({
  34 |             path: edge.node.frontmatter.slug,
  35 |             component: StoreTemplate,

File: gatsby-node.js:32:21

failed createPages - 0.097s
success createPagesStatefully - 0.067s
success onPreExtractQueries - 0.003s
success update schema - 0.027s
warn Using the global `graphql` tag is deprecated, and will not be supported in v3.
Import it instead like:  import { graphql } from 'gatsby' in file:
huynhpeter commented 4 years ago

had to populate contentful categories with actual content