1

Here's the error:

npm ERR! code 1
npm ERR! path /[...]/node_modules/pngquant-bin
npm ERR! command failed
npm ERR! command sh -c node lib/install.js
npm ERR! ⚠ spawn Unknown system error -86
npm ERR!   ⚠ pngquant pre-build test failed
npm ERR!   ℹ compiling from source
npm ERR!   ✖ Error: pngquant failed to build, make sure that libpng is installed
npm ERR!     at /[...]/node_modules/execa/index.js:231:11
npm ERR!     at runMicrotasks (<anonymous>)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:94:5)
npm ERR!     at async Promise.all (index 0)

Note: This is a purely native execution (no Rosetta translation).

Looks like there's an issue whenever a package needs to build a component in C.


Update 1.

I have created issues with the following repositories:

  1. pngquant-bin (imagemin-pngquant)
  2. optipng-bin (imagemin-optipng)
  3. mozjpeg (imagemin-mozjpeg)
Lindauson
  • 2,963
  • 1
  • 30
  • 33
  • Have you tried running it through Rosetta? – Dominik Mar 15 '21 at 04:45
  • I know it will work in Rosetta. Just seems odd that packages like pngquant installs fine using Homebrew but not via npm. – Lindauson Mar 15 '21 at 04:55
  • It seems to indicate that there isn't really an issue with the package running on Apple Silicon, but the environment. – Lindauson Mar 15 '21 at 04:56
  • If this were anything more complicated I would have "settled" to use Rosetta, but I know C/C++ builds fine on Apple Silicon, so I must be making a silly mistake. – Lindauson Mar 15 '21 at 05:01

1 Answers1

0

1. Use a supported imagemin package

The following imagemin packages will install on Apple Silicon:

PNG:
imagemin-oxipng
imagemin-zopfli

Gifs:
imagemin-gifsicle

JPEG:
imagemin-jpegtran

2. Use Rosetta 2

Link to official install instructions from Apple Support

Lindauson
  • 2,963
  • 1
  • 30
  • 33