WorkerError, Failed to process image. Gatsby

Viewed 607

Running gatsby build on production. Ubuntu 16.

Works on dev machine.

Error from server:

success write out redirect data - 0.002s
success Build manifest and related icons - 0.471s
success onPostBootstrap - 0.479s
info bootstrap finished - 6.775s
success run static queries - 0.569s - 3/3 5.28/s
[                            ]   0.567 s 0/3 0% Generating image thumbnails
[                            ]   0.001 s 0/4 0% run page queries

 ERROR 

Processing /home/sxxxx/src/images/icon.png failed

Original error:




  WorkerError: Processing /home/xxx/src/images/icon.png failed
  Original error:
  
  - jobs-manager.js:315 exports.enqueueJob
    [landingpage]/[gatsby]/dist/utils/jobs-manager.js:315:21
  
  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7
  

not finished Generating image thumbnails - 0.726s
not finished run page queries - 0.168s
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-default@0.1.0 build: `gatsby build`
npm ERR! Exit status 1
npm ERR! 

What do I do about it?

2 Answers

I also faced the same issue on Ubuntu 16 sometimes(re-ran build couple of times or more till it was successful, as a work around), though after increasing the memory of the machine I haven't faced it again.

This issue made it to official Gatsby channel here.

This comment and pull request I believe will resolve the issue for most people in the future when it is merged.

As a temporary solution I used in the build process (Dockerfile) whilst waiting for the pull request to make it all the way up to Gatsby.

RUN sed -i 's/error\.code[[:space:]]===[[:space:]]99/error.exitCode===99/' /your_app_path/node_modules/imagemin-pngquant/index.js

it makes the same change as the pull request I mentioned earlier (in this case as a Dockerfile step - "on the fly"), you need to make this change before running gatsby develop or gatsby build

Related