gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.22k stars 10.33k forks source link

WorkerError: failed to process image #21515

Closed pol4b closed 4 years ago

pol4b commented 4 years ago

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
LekoArts commented 4 years ago

Hi!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! 💜

nkcr commented 4 years ago

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
github-actions[bot] commented 4 years ago

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] commented 4 years ago

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

gayatri89 commented 4 years ago
npm install

hey thank you so much , it's working for me

ElijahLynn commented 4 years ago

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! :heart: :rocket:

hari5004 commented 4 years ago

Facing the same issue when buidling on GitLab CI

perstromswe commented 4 years ago

I have the same problem. Works on OS X but not on production Ubuntu 16.

stevemarksd commented 4 years ago

I have same problem, deleted cache and everything a few times...

$ gatsby info

  System:
    OS: Windows 10 10.0.x
    CPU: (12) x64 Intel(R) Core(TM) i7-xx00K CPU @ 3.70GHz
  Binaries:
    Node: 14.7.0 - ~\AppData\Local\Temp\yarn--x\node.CMD
    Yarn: 1.22.4 - ~\AppData\Local\Temp\yarn--x\yarn.CMD
    npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.8.5 - C:\Python38\python.EXE
  Browsers:
    Chrome: 84.0.x
  npmPackages:
    gatsby: 2.24.47 => 2.24.47
    gatsby-image: ^2.4.0 => 2.4.16
    gatsby-plugin-catch-links: ^2.0.9 => 2.3.11
    gatsby-plugin-emotion: ^3.0.1 => 3.0.1
    gatsby-plugin-layout: ^1.3.0 => 1.3.10
    gatsby-plugin-manifest: ^2.0.12 => 2.4.27
    gatsby-plugin-react-helmet: ^3.0.0 => 3.3.10
    gatsby-plugin-s3: ^0.3.4 => 0.3.5
    gatsby-plugin-sharp: ^2.0.15 => 2.6.31
    gatsby-plugin-sitemap: ^2.0.3 => 2.4.12
    gatsby-plugin-typescript: ^2.0.3 => 2.4.18
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.9 => 1.1.12
    gatsby-remark-component: ^1.1.3 => 1.1.3
    gatsby-remark-images: ^3.0.1 => 3.3.28
    gatsby-source-filesystem: ^2.3.23 => 2.3.27
    gatsby-transformer-remark: ^2.1.15 => 2.8.32
    gatsby-transformer-sharp: ^2.1.9 => 2.5.14

Also updated now gatsby and gatsby-image... same error

Sharp: => Found "sharp@0.25.4"

Looks like the error is swalloed so here is the real error: Command failed with exit code 99: ccc\\node_modules\\pngquant-bin\\vendor\\pngquant.exe - --strip --quality 100-100

davet42 commented 4 years ago

I have been working ona similar problem and found both this issue and the aforementioned #26273 See notes there for what I believe is a fix - the imagemin-pngquant package. I have a pull request in and am doing more testing. See the notes on https://github.com/gatsbyjs/gatsby/issues/26723 for the fix. In my environment, I thought first it was transparent png, then calls with quality = 100. Eventually found that status code 99 was not being checked properly in the imagemin-pngquant.

AndyBrownlie commented 4 years ago

yep, getting this same issue on Win10. Removed a png and now building as expected

andreibardas commented 4 years ago

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) :(

nikhilag commented 4 years ago

Why is this issue closed? I am still seeing the same issue on Windows 10.

nikhilag commented 4 years ago

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.

andreibardas commented 4 years ago

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!

karlhorky commented 4 years ago

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;
            }