Gatsby: Gatsby build hangs on createPagesStatefully

Created on 2 Feb 2018  ·  3Comments  ·  Source: gatsbyjs/gatsby

Description

I'm trying to follow the steps on how to deploy a Github Pages deployment here https://www.gatsbyjs.org/docs/how-gatsby-works-with-github-pages/#___gatsby. However when I run yarn run deploy or npm run deploy gatshby build hangs on createPagesStatefully indefinitely ( I have let it run for 15 mins with no result)

Environment

Gatsby version: 1.1.34
Node.js version: v8.9.0
Operating System: High Sierra

Actual result

```⇒ yarn run deploy
yarn run v1.3.2
$ gatsby build && gh-pages -d public -b master
success delete html files from previous builds — 0.047 s
success open and validate gatsby-config.js — 0.004 s
success copy gatsby files — 0.018 s
success onPreBootstrap — 0.004 s
success source and transform nodes — 0.014 s
success building schema — 0.068 s
success createLayouts — 0.023 s
success createPages — 0.001 s
⠄ createPagesStatefully

Most helpful comment

Description

I am having this problem too. Site is building fine until I drop this code into my gatsby-node.js:

exports.onCreatePage = ({ page, actions }) => {
  const { createPage, deletePage } = actions
  // get date
  let newDate = new Date()
  let date = newDate.getDate()
  let month = newDate.getMonth() 
  let year = newDate.getFullYear()
  const today = (foo)
  console.log(today)

  deletePage(page)
  createPage({
    ...page,
    context: {
      ...page.context,
      currentDate: today,
    },
  })
}

at which point running gatsby develop will freeze on createPagesStatefully.

Environment

Gatsby version: 2.15.18
Node v11.9.0
OS X Mojave

Actual output

~/sports ❯❯❯ gatsby develop                                                                                       ✘ 130 today ✱
success open and validate gatsby-configs - 0.048 s
success load plugins - 0.369 s
success onPreInit - 0.013 s
success initialize cache - 0.015 s
success copy gatsby files - 0.087 s
success onPreBootstrap - 0.024 s
success source and transform nodes - 4.600 s
success Add explicit types - 0.013 s
success Add inferred types - 0.182 s
success Processing types - 0.100 s
success building schema - 0.343 s
success createPages - 0.010 s
⠋ createPagesStatefully

All 3 comments

@wardy see #3813

Thanks, I missed that. Should I close this issue?

Description

I am having this problem too. Site is building fine until I drop this code into my gatsby-node.js:

exports.onCreatePage = ({ page, actions }) => {
  const { createPage, deletePage } = actions
  // get date
  let newDate = new Date()
  let date = newDate.getDate()
  let month = newDate.getMonth() 
  let year = newDate.getFullYear()
  const today = (foo)
  console.log(today)

  deletePage(page)
  createPage({
    ...page,
    context: {
      ...page.context,
      currentDate: today,
    },
  })
}

at which point running gatsby develop will freeze on createPagesStatefully.

Environment

Gatsby version: 2.15.18
Node v11.9.0
OS X Mojave

Actual output

~/sports ❯❯❯ gatsby develop                                                                                       ✘ 130 today ✱
success open and validate gatsby-configs - 0.048 s
success load plugins - 0.369 s
success onPreInit - 0.013 s
success initialize cache - 0.015 s
success copy gatsby files - 0.087 s
success onPreBootstrap - 0.024 s
success source and transform nodes - 4.600 s
success Add explicit types - 0.013 s
success Add inferred types - 0.182 s
success Processing types - 0.100 s
success building schema - 0.343 s
success createPages - 0.010 s
⠋ createPagesStatefully
Was this page helpful?
0 / 5 - 0 ratings

Related issues

andykais picture andykais  ·  3Comments

mikestopcontinues picture mikestopcontinues  ·  3Comments

benstr picture benstr  ·  3Comments

jimfilippou picture jimfilippou  ·  3Comments

kalinchernev picture kalinchernev  ·  3Comments