imagemin / pngquant-bin

pngquant bin-wrapper that makes it seamlessly available as a local dependency
http://pngquant.org
Other
115 stars 95 forks source link

SyntaxError: The requested module 'execa' does not provide an export named 'default' #138

Closed rivonia closed 2 years ago

rivonia commented 2 years ago

I am using pngquant-bin to install the pngquant binary needed to run pngquant:

// following just installs the pngquant binary...
import pngquant from 'pngquant-bin'; // https://www.npmjs.com/package/pngquant-bin (see also https://pngquant.org/)
// while the following enables streaming in association with pngquant (but needs a pre-installed binary)...
import PngQuant from 'pngquant'; // https://www.npmjs.com/package/pngquant
// ...
const myPngQuanter = new PngQuant(options);
// ...
bufferStream.pipe(myPngQuanter).pipe(res);

This has been working fine up to pngquant-bin 7.0.2 but has broken with 8.0.0, getting the following error:

uncaughtException: Error: Saw pngquant output on stderr: file:///usr/src/app/node_modules/pngquant-bin/cli.js:3
import execa from 'execa';
    ^^^^^
SyntaxError: The requested module 'execa' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

    at Socket.<anonymous> (/usr/src/app/node_modules/pngquant/lib/PngQuant.js:107:13)
    at Socket.emit (node:events:527:28)
    at Socket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)

Any ideas?