gatsby-transformer-remark Cannot Find 'allMarkdownRemark' in local env

Created on 9 Jun 2019  路  5Comments  路  Source: gatsbyjs/gatsby

Description

Gatsby "2.8.5"
Node "11.2"

I am seeing an issue when running a query inside graphQL playground. I have installed both "gatsby-source-filesystem": "^2.0.38", "gatsby-transformer-remark": "^2.3.12".

I have 2 markdown files created and sitting in the source folder. I am expecting to be able to see the data once called inside the playground.

query {
  allMarkdownRemark {
    edges {
      node {
        frontmatter {
          title 
        }
      }
    }
  }
}

I have followed the instructions for both plugins to a T. As well as looked though previous issues that others have faced but not found a solution that has worked.

When opening the docs inside the graphql playgroound I do not see the type "allMarkdownRemark" which I would expect to. Maybe I have not correctly installed...

"error": {
    "errors": [
      {
        "message": "Cannot query field \"allMarkdownRemark\" on type \"Query\".",
        "locations": [
          {
            "line": 2,
            "column": 3
          }
        ],
        "stack": [
          "GraphQLError: Cannot query field \"allMarkdownRemark\" on type \"Query\".",
          "    at Object.Field 

After installing and adding plugin to gatsby-config.js

module.exports = {
  siteMetadata: {
    title: `Every Other Days`,
    description: `Each week I will create and launch new websites and apps. Posting each here to showcase their story and purpose.`,
    author: `Travis Grossman`,
  },
  plugins: [
    `gatsby-plugin-sass`,
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `src`,
        path: `${__dirname}/src/`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images/`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `posts`,
        path: `${__dirname}/src/posts/`,
      },
    },
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        // CommonMark mode (default: true)
        commonmark: true,
        // Footnotes mode (default: true)
        footnotes: true,
        // Pedantic mode (default: true)
        pedantic: true,
        // GitHub Flavored Markdown mode (default: true)
        gfm: true,
        // Plugins configs
        plugins: [],
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],
}


I start dev server back up and go to http://localhost:8000/___graphql and run the above query and get the shown error.

I am expecting it to show my md files. Any help would be great or recent issues that may have a similar solution. Thank you

Most helpful comment

I started a new project and used the link you provided, I don't know what I did differently but it worked! Thank you for the help

All 5 comments

Do you have a sample repo you can make available for testing?

Do you have a sample repo you can make available for testing?

Thanks

If you are going to use Markdown you might want to look at the [Starter Blog] (https://github.com/gatsbyjs/gatsby/tree/master/starters/blog).

Second, it does look like you have added the Gatsby-node.js. This is a quick look. Had to drop my computer off for repairs.

If you are going to use Markdown you might want to look at the [Starter Blog] (https://github.com/gatsbyjs/gatsby/tree/master/starters/blog).

Second, it does look like you have added the Gatsby-node.js. This is a quick look. Had to drop my computer off for repairs.

Does adding gatsby that way cause issues? I will check out the link, thanks!

I started a new project and used the link you provided, I don't know what I did differently but it worked! Thank you for the help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

magicly picture magicly  路  3Comments

ghost picture ghost  路  3Comments

andykais picture andykais  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

rossPatton picture rossPatton  路  3Comments