gatsby: WorkerError: failed to process image

I was using gatsby to well until yesterday. Today I moved whole gatsby site folder to my laptop. On my laptop there’s all dependencies installed and all files posts, images, files etc. were moved successfully. But, if I try to build my site gatsby throws error on processing images. Permissions are right what do I have to check else?

gatsby --version
Gatsby CLI version: 2.8.29
Gatsby version: 2.19.12
  Note: this is the Gatsby version for the site at: /home/pol4bear/Blog/Blog
# gatsby clean && gatsby build
success open and validate gatsby-configs - 0.111s
success load plugins - 0.564s
success onPreInit - 0.006s
success initialize cache - 0.018s
success copy gatsby files - 0.029s
success onPreBootstrap - 0.013s
success createSchemaCustomization - 0.084s
success source and transform nodes - 2.696s
success building schema - 0.530s
success createPages - 0.139s
success createPagesStatefully - 0.049s
success onPreExtractQueries - 0.002s
success update schema - 0.042s
success extract queries from components - 0.350s
success write out requires - 0.077s
success write out redirect data - 0.011s
success Build manifest and related icons - 0.164s
success onPostBootstrap - 0.189s
⠀
info bootstrap finished - 6.855 s
⠀

 ERROR 

Processing /home/pol4bear/Blog/Blog/static/media/2016/07/CIA.png failed

Original error:




  WorkerError: Processing /home/pol4bear/Blog/Blog/static/media/2016/07/CIA.png failed
  Original error:
  
  - jobs-manager.js:314 exports.enqueueJob
    [Blog]/[gatsby]/dist/utils/jobs-manager.js:314:23
  
  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5
  

not finished run queries - 0.389s
not finished Generating image thumbnails - 0.315s

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I’m glad you reported this, the same happens to me. Works fine on OS X but fails on my Ubuntu server.

Edit: Solved by re-installing the modules

rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install

Workaround with latest versions of plugins (without changing image quality)

  1. Install patch-package (npm install patch-package or yarn add patch-package postinstall-postinstall)
  2. Add "postinstall": "patch-package" to scripts in package.json
  3. Go into node_modules/imagemin-pngquant/index.js and change error.code to error.exitCode on line 66 (see diff below)
  4. Run npx patch-package imagemin-pngquant
  5. Commit the changes, including the patch

This will save the change that you make to the index.js file and apply it any time / anywhere that npm install or yarn is run in the project.

Diff (difference before and after)

	const promise = subprocess
		.then(result => result.stdout) // eslint-disable-line promise/prefer-await-to-then
		.catch(error => {
-			if (error.code === 99) {
+			if (error.exitCode === 99) {
				return input;
			}

This solution worked for me from the thread - https://github.com/gatsbyjs/gatsby/issues/26723

My current solution is to downgrade gatsby-plugin-sharp to version 2.6.26.

Solved by re-installing the modules

rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install

You just saved me after an hour of debugging! THANK YOU! ❤️ 🚀

so guys, I solved my issue by changing all image quality from 100 to 99. took me 1 hour (be carefull with “replace all”). I hope this will help someone!

I’m glad you reported this, the same happens to me. Works fine on OS X but fails on my Ubuntu server.

Edit: Solved by re-installing the modules

rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install

not working for me (tried cleaning everything) 😦