Skip to content

Log original error for easier debugging of the underlying build error#106

Open
glenselle wants to merge 1 commit intoimagemin:mainfrom
glenselle:master
Open

Log original error for easier debugging of the underlying build error#106
glenselle wants to merge 1 commit intoimagemin:mainfrom
glenselle:master

Conversation

@glenselle
Copy link
Copy Markdown

Currently, when a build error occurs, the catch within lib/install.js is overriding the error's message with a static error message. This ends up hiding the underlying issue. In my case, on OSX 10.14.2 I did a brew install libpng per the static error message and nothing changed. This caused me wonder what was actually happening. Upon digging into the source it became clear the actual build error was not being surfaced. This change surfaces the real underlying issue. See the before and after output below:

Before

~/Git/pngquant-bin (master) $ node lib/install.js 
  ⚠ unable to get local issuer certificate
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✖ Error: pngquant failed to build, make sure that libpng is installed
    at Promise.all.then.arr (/Users/gesell/Git/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)

After

~/Git/pngquant-bin (master) $ node lib/install.js 
  ⚠ unable to get local issuer certificate
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✖ pngquant failed to build -- usually this happens because libpng is not installed
  ✖ Error: Command failed: /bin/sh -c ./configure --prefix="/Users/gesell/Git/pngquant-bin/vendor"


  Compiler: gcc
     Debug: no
       SSE: yes
    OpenMP: no
imagequant: build static
    libpng: shared (1.6.37)
      zlib: error ... not found (please install zlib-devel package)


    at Promise.all.then.arr (/Users/gesell/Git/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)

A quick search on zlib-devel for OSX turned up an SO post: https://stackoverflow.com/questions/23749530/brew-install-zlib-devel-on-mac-os-x-mavericks which made me realize I had an issue with my xcode-select tools. Without the more descriptive error, I wouldn't have realized what was actually causing my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant