Tuesday, 25 December 2018

Gatsby develop and Gatsby info both returning errors

I don't quite know what happened to my build, Currently gatsby develop is returning TypeError: Cannot read property 'allMarkdownRemark' of undefined pointing to this file

gatsby-node.js:19 graphql.then.results
C:/Users/Anders/sites/gatsby-netlify-cms/gatsby-node.js:19:20

and gatsby info is returning after it returns info about the project error The system cannot find the path specified.

Here is the gatsby-node.js file

const path = require('path')

exports.createPages = ({ graphql, actions }) => {
  const { createPage } = actions
  return new Promise((resolve, reject) => {
    graphql(`
      {
        allMarkdownRemark {
          edges {
            node {
              frontmatter {
                slug
              }
            }
          }
        }
      }
    `).then(results => {
      results.data.allMarkdownRemark.edges.forEach(({ node }) => {
        createPage({
          path: `/posts${node.frontmatter.slug}`,
          component: path.resolve('./src/components/postLayout.js'),
          context: {
            slug: node.frontmatter.slug,
          },
        })
      })
      resolve()
    })
  })
}

I don't quite understand what is going on, I rolled back to changes that were working fine a minute ago, and now getting this weird error. I have tried upgrading node, I have tried reinstalling the gatsby cli. I am stuck. Thanks in advance.

Also including my package.json in case there is incompatibilities

{
  "name": "gatsby-starter-default",
  "description": "Gatsby default starter",
  "version": "1.0.0",
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
  "dependencies": {
    "babel-plugin-styled-components": "^1.9.2",
    "gatsby": "^2.0.53",
    "gatsby-image": "^2.0.22",
    "gatsby-plugin-manifest": "^2.0.9",
    "gatsby-plugin-netlify": "^2.0.6",
    "gatsby-plugin-netlify-cms": "^3.0.9",
    "gatsby-plugin-offline": "^2.0.16",
    "gatsby-plugin-react-helmet": "^3.0.2",
    "gatsby-plugin-sharp": "^2.0.15",
    "gatsby-plugin-sitemap": "^2.0.3",
    "gatsby-plugin-styled-components": "^3.0.4",
    "gatsby-source-filesystem": "^2.0.10",
    "gatsby-transformer-remark": "^2.1.15",
    "gatsby-transformer-sharp": "^2.1.9",
    "netlify-cms": "^2.3.0",
    "react": "^16.6.3",
    "react-dom": "^16.6.3",
    "react-helmet": "^5.2.0",
    "react-spring": "^6.1.10",
    "styled-components": "^4.1.2"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "scripts": {
    "build": "gatsby build",
    "develop": "gatsby develop",
    "start": "npm run develop",
    "format": "prettier --write \"src/**/*.js\"",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "prettier": "^1.15.2"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/gatsbyjs/gatsby-starter-default"
  }
}

Gatsby -v returns 2.4.7 and I am running node v10.14.2



from Gatsby develop and Gatsby info both returning errors

No comments:

Post a Comment