Error: Cannot find module 'imagemin-optipng'

See original GitHub issue

Tried reinstall but still get this error

› imagemin

module.js:340
    throw err;
    ^
Error: Cannot find module 'imagemin-optipng'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/tcarlsen/.nvm/v0.10.26/lib/node_modules/imagemin/index.js:171:26)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

On install this error is showing:

npm WARN optional dep failed, continuing imagemin-optipng@0.1.0

> pngquant-bin@0.3.0 postinstall /Users/tcarlsen/.nvm/v0.10.26/lib/node_modules/imagemin/node_modules/imagemin-pngquant/node_modules/pngquant-bin
> node index.js

✗ pre-build test failed, compiling from source...
✗ Error: Command failed: In file included from pngquant.c:59:
./rwpng.h:35:10: fatal error: 'png.h' file not found
#include "png.h"    /* libpng header; includes zlib.h */
         ^
1 error generated.
make: *** [pngquant.o] Error 1

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
matt-baileycommented, May 6, 2014

Yes, in my case that was it - missing libpng-dev library.

0reactions
tcarlsencommented, May 7, 2014

yes a simple brew install libpng did the trick. I will agree with @sindresorhus that a better error msg would have helped me and this issue would never have been created 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

imagemin-optipng - npm
Imagemin plugin for OptiPNG. Latest version: 8.0.0, last published: 3 years ago. Start using imagemin-optipng in your project by running ...
Read more >
gulp-imagemin error with optipng command failed issue only ...
I get command failed: /app/node_modules/optipng-bin/vendor/optipng --version issue while building on docker. I don't get issue when I run it ...
Read more >
ImageMinimizerWebpackPlugin | webpack
Plugin and Loader for webpack to optimize (compress) all images using imagemin. Do not worry about size of images, now they are always...
Read more >
Imagemin issue - sage - Roots Discourse
If no images to optimize in assets/images, no error. ... /imagemin-optipng/node_modules/optipng-bin/vendor/optipng ENOENT ... rm -rf node-modules/.
Read more >
Use Imagemin to compress images - web.dev
Imagemin is available as both a CLI and an npm module. ... If a plugin doesn't mention whether it is "lossy" or "lossless,"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found