gatsby: Build gets stuck at Generating image thumbnails / Update schema on large sites
I am querying allImageSharp
in a project with 300 pages and 2000 images in gatsby-node.
During gatsby build
or gatsby develop
, the build process freezes when generating thumbnail 20~ or so
Generating image thumbnails [==----------------------------] 25/9667 24.0 secs 0%
I also have the same query called in a static query on a page. If I remove the query from gatsby-node and use only the one in the page, the thumbnails generation correctly in around 600 seconds
Generating image thumbnails [=============================-] 9235/9667 560.0 secs 96%
This is what my query looks like:
gallery: allImageSharp {
edges {
node {
fluid(
sizes: "(orientation: portrait) 50vw, (orientation: portrait) and (min-width: 750px) 30vw, (orientation: landscape) 30vw,(orientation: landscape) and (min-width: 1170px) 18vw,(orientation: landscape) and (min-width: 1800px) 16vw"
) {
aspectRatio
base64
presentationHeight
presentationWidth
sizes
src
srcSet
}
}
}
}
Environment
System:
OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.15.3/bin/npm
Languages:
Python: 2.7.15 - /usr/local/bin/python
npmPackages:
gatsby: ^2.4.5 => 2.4.5
gatsby-image: ^2.0.41 => 2.0.41
gatsby-plugin-algolia: ^0.3.0 => 0.3.0
gatsby-plugin-intl: ^0.1.7 => 0.1.7
gatsby-plugin-manifest: ^2.1.1 => 2.1.1
gatsby-plugin-matomo: ^0.7.0 => 0.7.0
gatsby-plugin-offline: ^2.1.0 => 2.1.0
gatsby-plugin-react-helmet: ^3.0.12 => 3.0.12
gatsby-plugin-robots-txt: ^1.4.0 => 1.4.0
gatsby-plugin-sass: ^2.0.11 => 2.0.11
gatsby-plugin-sharp: ^2.0.37 => 2.0.37
gatsby-plugin-sitemap: ^2.1.0 => 2.1.0
gatsby-plugin-typescript: ^2.0.13 => 2.0.13
gatsby-remark-images: ^3.0.11 => 3.0.11
gatsby-source-filesystem: ^2.0.34 => 2.0.34
gatsby-transformer-json: ^2.1.11 => 2.1.11
gatsby-transformer-remark: ^2.3.12 => 2.3.12
gatsby-transformer-sharp: ^2.1.19 => 2.1.19
npmGlobalPackages:
gatsby-cli: 2.5.14
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 18 (2 by maintainers)
What has worked for me: Downgrade node.js
Delete node_modules & package-lock.json & yarn.lock
Use nvm(node version manager) and switch to node version 10.18.1: nvm install 10.18.1 nvm use 10.18.1
yarn install
gatsby clean
gatsby develop / gatsby build
I’m having a similar issue however not on a large site.
I implemented createPages api in gatsby-node with markdown files. The page template use to create these pages got a page query based on a context variable passed down to the createPage function.
No matter if it’s only 1 or 10 pages generated with between 10 to 15 images per page, the develop command go through successfully however the build command finishes before the generating image thumbnails process.
I tried gatsby clean and removed node_module folder before reinstalling and fresh build but always get stuck there. (the percentage of images completed is random between 85% and 99% generally and doesn’t throw any error)
I can’t figure why the sharp process don’t complete before gatsby finishes building.
Is this still happening with latest sharp?
@wardpeet, unfortunately, yes.
EDIT: Sorry that was not really a constructive answer. So, after
onPostBuild
it looks like the thumbnails are being generated again. After downgrading to Node version10.18.1
this issue was resolved. The problem that persists is that the images are not displaying ongatsby build
, but only ongatsby develop
. It seems like it happens after more than 5 images get loaded.I’m currently running into this issue trying to get Gatsby to build on a vanilla Ubuntu server. Running Node 12 there. Each time the build hits “generating image previews” and starts processing (what seems to be) the first PNG, it dies with a WorkerError with the stack only mentioning:
jobs-manager.js:314 exports.enqueueJob [site]/[gatsby]/dist/utils/jobs-manager.js:314:23
task_queues.js:97 processTicksAndRejections internal/process/task_queues.js:97:5
@gvocale thank you for the repro, that should be very helpful to work out what’s going on.
@wardpeet or @sidharthachatterjee do one of you have a chance to investigate this?
@gvocale can you share a reproduction so that the issue can be looked at? And find a solution or an alternative to your issue?