343dev / optimizt

CLI image optimization tool
MIT License
77 stars 3 forks source link

guetzli pre-build test failed - Error on NPM install #2

Closed robert-j-webb closed 10 months ago

robert-j-webb commented 10 months ago

Hey I ran npm i -g @343dev/optimizt and I found this issue. I'm using MacOs - maybe there's some undocumented dep?

npm ERR! code 1
npm ERR! path /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/guetzli
npm ERR! command failed
npm ERR! command sh -c node lib/install.js
npm ERR! compiling from source
npm ERR! guetzli built successfully
npm ERR! Command failed: /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/guetzli/vendor/guetzli /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/guetzli/test/fixtures/test.jpg /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/guetzli/test/fixtures/dest.jpg
npm ERR! Can't open input file
npm ERR! 
npm ERR! 
npm ERR! guetzli pre-build test failed
npm ERR! /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/execa/index.js:231
npm ERR!                                err = new Error(`Command failed: ${joinedCmd}${output}`);
npm ERR!                                      ^
npm ERR! 
npm ERR! Error: Command failed: /bin/sh -c make && mv bin/Release/guetzli /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/guetzli/vendor/guetzli
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! guetzli/guetzli.cc:23:10: fatal error: 'png.h' file not found
npm ERR! #include "png.h"
npm ERR!          ^~~~~~~
npm ERR! 1 error generated.
npm ERR! make[1]: *** [obj/Release/guetzli.o] Error 1
npm ERR! make: *** [guetzli] Error 2
npm ERR! 
npm ERR! ==== Building guetzli (release) ====
npm ERR! Creating bin/Release
npm ERR! Creating obj/Release
npm ERR! butteraugli_comparator.cc
npm ERR! dct_double.cc
npm ERR! debug_print.cc
npm ERR! entropy_encode.cc
npm ERR! fdct.cc
npm ERR! gamma_correct.cc
npm ERR! guetzli.cc
npm ERR! 
npm ERR!     at /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/execa/index.js:231:11
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
npm ERR!   code: 2,
npm ERR!   killed: false,
npm ERR!   stdout: '==== Building guetzli (release) ====\n' +
npm ERR!     'Creating bin/Release\n' +
npm ERR!     'Creating obj/Release\n' +
npm ERR!     'butteraugli_comparator.cc\n' +
npm ERR!     'dct_double.cc\n' +
npm ERR!     'debug_print.cc\n' +
npm ERR!     'entropy_encode.cc\n' +
npm ERR!     'fdct.cc\n' +
npm ERR!     'gamma_correct.cc\n' +
npm ERR!     'guetzli.cc\n',
npm ERR!   stderr: '/bin/sh: pkg-config: command not found\n' +
npm ERR!     '/bin/sh: pkg-config: command not found\n' +
npm ERR!     '/bin/sh: pkg-config: command not found\n' +
npm ERR!     '/bin/sh: pkg-config: command not found\n' +
npm ERR!     '/bin/sh: pkg-config: command not found\n' +
npm ERR!     '/bin/sh: pkg-config: command not found\n' +
npm ERR!     '/bin/sh: pkg-config: command not found\n' +
npm ERR!     "guetzli/guetzli.cc:23:10: fatal error: 'png.h' file not found\n" +
npm ERR!     '#include "png.h"\n' +
npm ERR!     '         ^~~~~~~\n' +
npm ERR!     '1 error generated.\n' +
npm ERR!     'make[1]: *** [obj/Release/guetzli.o] Error 1\n' +
npm ERR!     'make: *** [guetzli] Error 2\n',
npm ERR!   failed: true,
npm ERR!   signal: null,
npm ERR!   cmd: '/bin/sh -c make && mv bin/Release/guetzli /Users/robertwebb/.nvm/versions/node/v18.15.0/lib/node_modules/@343dev/optimizt/node_modules/guetzli/vendor/guetzli',
npm ERR!   timedOut: false
npm ERR! }
npm ERR! 
npm ERR! Node.js v18.15.0

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/robertwebb/.npm/_logs/2023-11-03T21_27_23_404Z-debug-0.log
robert-j-webb commented 10 months ago

Sorry I see brew install pkg-config libpng as the solution here! That worked thanks!