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)
1

There are 1 best solutions below

1
On

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