While deploying gatsby site to Netlify
$ yarn run build
yarn run v1.13.0
$ rm -rf public && rm -rf .cache && gatsby build
success open and validate gatsby-configs โ 0.043 s
success load plugins โ 1.595 s
success onPreInit โ 24.500 s
success delete html and css files from previous builds โ 0.038 s
success initialize cache โ 0.273 s
success copy gatsby files โ 1.970 s
success onPreBootstrap โ 0.022 s
success source and transform nodes โ 0.823 s
success building schema โ 11.416 s
success createPages โ 0.378 s
success createPagesStatefully โ 0.207 s
success onPreExtractQueries โ 0.002 s
success update schema โ 0.447 s
success extract queries from components โ 0.470 s
success run graphql queries โ 10.306 s โ 53/53 5.14 queries/second
success write out page data โ 0.024 s
success write out redirect data โ 0.004 s
โ onPostBootstrapdone generating icons for manifest
success onPostBootstrap โ 0.681 s
info bootstrap finished - 80.863 s
success Building production JavaScript and CSS bundles โ 34.728 s
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://gatsby.app/debug-html
39 | )}
40 |
> 41 | {posts.map(({ node }) => {
| ^
42 | const title = get(node, 'frontmatter.title') || node.fields.slug;
43 | return (
44 | <article key={node.fields.slug}>
WebpackError: TypeError: Cannot read property 'map' of undefined
- blog-index.js:41 BlogIndexTemplate.render
lib/src/templates/blog-index.js:41:18
- bootstrap:24 Sa
lib/webpack/bootstrap:24:1
- bootstrap:29 a.render
lib/webpack/bootstrap:29:1
- bootstrap:40 renderToString
lib/webpack/bootstrap:40:1
- static-entry.js:190 Module../.cache/static-entry.js.__webpack_exports__.default
lib/.cache/static-entry.js:190:18
- bootstrap:24 Promise
lib/webpack/bootstrap:24:1
- gatsby-browser-entry.js:1 Promise._resolveFromExecutor
lib/.cache/gatsby-browser-entry.js:1:1
- bootstrap:68 new Promise
lib/webpack/bootstrap:68:1
- bootstrap:5 tryCatcher
lib/webpack/bootstrap:5:1
- bootstrap:50 MappingPromiseArray._promiseFulfilled
lib/webpack/bootstrap:50:1
- api-runner-ssr.js:6 MappingPromiseArray.PromiseArray._iterate
lib/.cache/api-runner-ssr.js:6:16
- bootstrap:67 MappingPromiseArray.init
lib/webpack/bootstrap:67:1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
It looks like your posts array is undefined. I'd suggest checking if they actually return, and if not, why they're not returning
To add to what @aderaaij said - I would also suggest updating gatsby - we added logging on what page it fails recently, so you could narrow down where this is happening
Thanks, it has been fixed.
Hello. During Development it works, but when i build it shows me error
Most helpful comment
To add to what @aderaaij said - I would also suggest updating gatsby - we added logging on what page it fails recently, so you could narrow down where this is happening