Giter Site home page Giter Site logo

cwebp-bin's Introduction

imagemin

Minify images seamlessly

Install

npm install imagemin

Usage

import imagemin from 'imagemin';
import imageminJpegtran from 'imagemin-jpegtran';
import imageminPngquant from 'imagemin-pngquant';

const files = await imagemin(['images/*.{jpg,png}'], {
	destination: 'build/images',
	plugins: [
		imageminJpegtran(),
		imageminPngquant({
			quality: [0.6, 0.8]
		})
	]
});

console.log(files);
//=> [{data: <Uint8Array 89 50 4e …>, destinationPath: 'build/images/foo.jpg'}, …]

API

imagemin(input, options?)

Returns Promise<object[]> in the format {data: Uint8Array, sourcePath: string, destinationPath: string}.

input

Type: string[]

File paths or glob patterns.

options

Type: object

destination

Type: string

Set the destination folder to where your files will be written. If no destination is specified, no files will be written.

plugins

Type: Array

The plugins to use.

glob

Type: boolean
Default: true

Enable globbing when matching file paths.

imagemin.buffer(data, options?)

Returns Promise<Uint8Array>.

data

Type: Uint8Array

The image data to optimize.

options

Type: object

plugins

Type: Array

Plugins to use.

Related

cwebp-bin's People

Contributors

1000ch avatar ewouth avatar kevcenteno avatar kevva avatar rejas avatar shinnn avatar sindresorhus avatar umaar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cwebp-bin's Issues

cwebp error

[admin@192-168-6-205 app]$ /home/admin/zhump/app/node_modules/cwebp-bin/vendor/cwebp -q 75 ./__webp/temp.png -o ./__webp/temp.png.webp
/home/admin/zhump/app/node_modules/cwebp-bin/vendor/cwebp: error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory

that is error !

but

[admin@192-168-6-205 app]$ cwebp -q 75 ./__webp/temp.png -o ./__webp/temp.png.webp                                                    
Saving file './__webp/temp.png.webp'
File:      ./__webp/temp.png
Dimension: 459 x 307 (with alpha)
Output:    7368 bytes Y-U-V-All-PSNR 43.98 99.00 99.00   45.74 dB
block count:  intra4: 211
              intra16: 369  (-> 63.62%)
              skipped block: 321 (55.34%)
bytes used:  header:             60  (0.8%)
             mode-partition:    952  (12.9%)
             transparency:     3974 (99.0 dB)
 Residuals bytes  |segment 1|segment 2|segment 3|segment 4|  total
    macroblocks:  |       4%|      16%|      22%|      57%|     580
      quantizer:  |      36 |      34 |      30 |      20 |
   filter level:  |      11 |       8 |       6 |       3 |
Lossless-alpha compressed size: 3973 bytes
  * Header size: 85 bytes, image data size: 3888
  * Lossless features used: PALETTE
  * Precision Bits: histogram=5 transform=5 cache=0
  * Palette size:   254

that is right !

Strange file created on arm64

Hello everyone,

I'm using [email protected], which requires [email protected] on a ubuntu 18.04 with arm64 architecture I end up having a file with

user@manager-web$ nodejs --version
v16.16.0
user@manager-web$ npm -v
8.16.0
user@manager-web$ ls node_modules/cwebp-bin/ -lah
total 52K
drwxr-xr-x   4 user user 4.0K Aug 11 10:48  .
drwxr-xr-x 537 user user  20K Aug 11 10:20  ..
-rw-r--r--   1 user user    0 Aug 11 10:18 ''$'\001\225\001''@'$'\b\v''@@8'
-rwxr-xr-x   1 user user  219 Aug 11 10:18  cli.js
-rw-r--r--   1 user user   62 Aug 11 10:18  index.js
drwxr-xr-x   2 user user 4.0K Aug 11 10:18  lib
-rw-r--r--   1 user user 1.1K Aug 11 10:18  license
-rw-r--r--   1 user user  924 Aug 11 10:18  package.json
-rw-r--r--   1 user user  915 Aug 11 10:18  readme.md
drwxr-xr-x   6 user user 4.0K Aug 11 10:20  vendor

Do you have any idea where is that coming from? I can confirm that using same setup, but on a x86_64 architecture I don't have this file.

Thanks in advance

npm audit: memory exposure bin-wrapper > download > caw > tunnel-agent

Running npm audit in our project logs:

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.6.0                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ image-webpack-loader [dev]                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ image-webpack-loader > imagemin-webp > cwebp-bin >           │
│               │ bin-wrapper > download > caw > tunnel-agent                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘

The reason is this chain:

    └─┬ [email protected]
      └─┬ [email protected]
        └─┬ [email protected]
          └── [email protected]
│           └── [email protected]

bin-build is already updated to ^3.0.0 on master as of 1ea88e7 which should solve the issue:

1ea88e7 is not published to npm yet.
Do you plan to publish the current version to npm in the near future?

JPEG support not compiled. Please install the libjpeg development package before building.

centos

{ [Error: Command failed: /usr/local/node_4.4.4.3/lib/node_modules/fis-postpackager-jpgtowebp/node_modules/cwebp-binLocal/vendor/linux/x64/cwebp /data1/htdocs/m.fanxing.com/static/mobile/520Activity/images/img_4.jpg -o /data1/htdocs/m.fanxing.com/staticPub/images/_f469d98.webp
JPEG support not compiled. Please install the libjpeg development package before building.
Error! Could not process file /data1/htdocs/m.fanxing.com/static/mobile/520Activity/images/img_4.jpg
Error! Cannot read input picture file '/data1/htdocs/m.fanxing.com/static/mobile/520Activity/images/img_4.jpg'
]
killed: false,
code: 255,
signal: null,
cmd: '/usr/local/node_4.4.4.3/lib/node_modules/fis-postpackager-jpgtowebp/node_modules/cwebp-binLocal/vendor/linux/x64/cwebp /data1/htdocs/m.fanxing.com/static/mobile/520Activity/images/img_4.jpg -o /data1/htdocs/m.fanxing.com/staticPub/images/_f469d98.webp' }

cwebp ENOENT

[2019-12-02T16:41:45.526Z] /bin/sh: lscpu: not found
[2019-12-02T16:41:45.526Z] success Rewriting compilation hashes - 0.003s
[2019-12-02T16:41:45.526Z] success run queries - 106.670s - 85/85 0.80/s
[2019-12-02T16:41:45.526Z] 
[2019-12-02T16:41:45.526Z]  ERROR
[2019-12-02T16:41:45.526Z] 
[2019-12-02T16:41:45.526Z] UNHANDLED REJECTION spawn /usr/app/node_modules/cwebp-bin/vendor/cwebp ENOENT
[2019-12-02T16:41:45.526Z] 
[2019-12-02T16:41:45.526Z] 
[2019-12-02T16:41:45.526Z] 
[2019-12-02T16:41:45.526Z]   Error: spawn /usr/app/node_modules/cwebp-bin/vendor/cwebp ENOENT
[2019-12-02T16:41:45.526Z]   
[2019-12-02T16:41:45.526Z]   - child_process.js:264 Process.ChildProcess._handle.onexit
[2019-12-02T16:41:45.526Z]     internal/child_process.js:264:19
[2019-12-02T16:41:45.526Z]   
[2019-12-02T16:41:45.526Z]   - child_process.js:456 onErrorNT
[2019-12-02T16:41:45.526Z]     internal/child_process.js:456:16
[2019-12-02T16:41:45.526Z]   
[2019-12-02T16:41:45.526Z]   - task_queues.js:80 processTicksAndRejections
[2019-12-02T16:41:45.526Z]     internal/process/task_queues.js:80:21
[2019-12-02T16:41:45.526Z]   
[2019-12-02T16:41:45.526Z] 
[2019-12-02T16:41:45.526Z] not finished Generating image thumbnails - 1.391s

Attempting to run this package we are getting this error.

Running Node 12
Linux docker container

Any chance of adding error logging for the stderr output?

Update `bin-build` to version 3.0.0

The dependency chain from the current [email protected] dependency includes gulp-util, which is deprecated, but [email protected] does not have that issue. I know there is a major version change to account for, so it would be more work than just a version bump, but it would be great to get this updated, if possible.

I'm a bit busy this week, but if you'd prefer a pull request, I can work on one when I find some time.

Thanks so much!

[email protected] postinstall: `node lib/install.js`

internal/modules/cjs/loader.js:1174
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\vue3Test\hello-vue3\node_modules\cwebp-bin\lib\install.js
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1174:13)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'ERR_REQUIRE_ESM'
}

ENOENT error

Hi!

I use gulp-webp. After last cwebp-bin update I see the Error: spawn ENOENT error message (on PNG files only).

I use Ubuntu 14.04, original cwebp utility works fine.

CLI output:

$ sudo npm install -g cwebp-bin
/usr/bin/cwebp -> /usr/lib/node_modules/cwebp-bin/cli.js

> [email protected] postinstall /usr/lib/node_modules/cwebp-bin
> node install.js

  ✔ cwebp pre-build test passed successfully
npm WARN unmet dependency /usr/lib/node_modules/npm/node_modules/npm-package-arg requires semver@'4' but will load
npm WARN unmet dependency /usr/lib/node_modules/npm/node_modules/semver,
npm WARN unmet dependency which is version 2.3.0
[email protected] /usr/lib/node_modules/cwebp-bin
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
kolek@kolek:~/projects/7days/7days-redesign$ cwebp --help

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)

PNG support not compiled. Please install the libpng development package before building

code: 255,
[47.114.79.66] out:   killed: false,
[47.114.79.66] out:   stdout: '',
[47.114.79.66] out:   stderr: 'PNG support not compiled. Please install the libpng development package before building.\n' +
[47.114.79.66] out:     'Error! Could not process file /tmp/383ae358-1cd2-4062-bb75-d66f01a163c8\n' +
[47.114.79.66] out:     "Error! Cannot read input picture file '/tmp/383ae358-1cd2-4062-bb75-d66f01a163c8'\n",
[47.114.79.66] out:   failed: true,
[47.114.79.66] out:   signal: null,
[47.114.79.66] out:   cmd: '/data/.lukou_source/activity/node_modules/cwebp-bin/vendor/cwebp -quiet -mt -preset default -q 75 -alpha_q 100 -m 1 -sns 80 -o /tmp/ee792ef8-417e-4f29-b2a7-762b4675d9d0 /tmp/383ae358-1cd2-4062-bb75-d66f01a163c8',
[47.114.79.66] out:   timedOut: false

hello, how to fix this in linux server?

Locally installed distro binaries ignored?

I have a docker alpine image. I'm building it without wanting to compile binaries for packages. I have cwebp binary from an official Alpine package installed already. cwebp -version returns 1.0.0, this package only seems to source binaries via URLs to this repo and then call the binary version check?

Not sure why this is failing, is it downloading a binary for linux assuming compatibility with Alpine and preferring that invalid binary to the globally installed one?

node node_modules/cwebp-bin/lib/install.js
  ⚠ spawn /site/node_modules/cwebp-bin/vendor/cwebp ENOENT
  ⚠ cwebp pre-build test failed
  ℹ compiling from source

It's here:

ls node_modules/cwebp-bin/vendor
cwebp

fails to run:

./node_modules/cwebp-bin/vendor/cwebp -version
/bin/sh: ./node_modules/cwebp-bin/vendor/cwebp: not found

outside of that location, running installed alpine package version works fine:

cwebp -version
1.0.0

Reduce npm dependencies

This small package has 153 nested dependencies.

Снимок экрана от 2022-02-21 22-10-39

Can we reduce this number? It looks too dangerous for performance and security reasons.

Couldn't access Windows Imaging Component

Hi, I'm running imagemin-webp on Windows 7, it throws an erorr

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: CoCreateInstance(MAKE_REFGUID(CLSID_WICImagingFactory), NULL, CLSCTX_INPR                                                                                            OC_SERVER, MAKE_REFGUID(IID_IWICImagingFactory), (LPVOID*)&factory) failed 80040                                                                                            154
Couldn't access Windows Imaging Component (are you running Windows XP SP3 or new                                                                                            er?). Most formats not available. Use -s for the available YUV input.
Decoding of input data failed.
Status: 3(BITSTREAM_ERROR)
Error! Could not process file C:\Users\ADMINI~1\AppData\Local\Temp\d49c283e-4e92                                                                                            -4a6d-a557-1a982d084787
Error! Cannot read input picture file 'C:\Users\ADMINI~1\AppData\Local\Temp\d49c                                                                                            283e-4e92-4a6d-a557-1a982d084787'

    at ChildProcess.exithandler (child_process.js:202:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at ChildProcess.cp.emit (D:\juanpi_code\actstatic\node_modules\cross-spawn-a                                                                                            sync\lib\enoent.js:37:29)
    at maybeClose (internal/child_process.js:852:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:492:12)

Couldn't access Windows Imaging Component (are you running Windows XP SP3 or new er?)

But i'm running it on windows 7.
I'v googled a lot , but cannot find an answer.

Decoding of input data failed.

I have got this error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: IWICImagingFactory_CreateDecoderFromStream( factory, stream, NULL, WICDecodeMetadataCacheOnDemand, &decoder) failed 88982f50
Decoding of input data failed.
Status: 2(INVALID_PARAM)
Error! Could not process file -
Error! Cannot read input picture file '-'

at ChildProcess.<anonymous> (D:\programing\www\imageConverter\node_modules\imagemin-webp\index.js:93:11)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)

when i have a pic named 'lo_go.png'.

"support not compiled" : missing libjpeg, libpng, libtiff and libgif at compile time

I came accross cwebp-bin come from webpack's plugin image-webpack-loader. Once I enabled WEBP in that plugin, I started getting errors such as:

Error: PNG support not compiled. Please install the libpng development package before building.
Error: JPEG support not compiled. Please install the libjpeg development package before building.

Those errors come from the cwebp binary located in the cwebp-bin/vendor folder.

When cwebp-bin installed, the pre-build check failed and compilation took place --successfully. Looking at the install script cwebp-bin/lib/install.js, I can see that it just calls configure and make on the source distribution. As stated, this works; but it does not help a lot, since it builds a binary without support for any legacy file format (png, jpeg, tiff, gif): The WEBP documentation states:

Preparing the Platform

Linux
Install the libjpeg, libpng, libtiff and libgif packages, needed to convert between JPEG, PNG, TIFF, GIF and WebP image formats.

Package management varies by Linux distribution. On Ubuntu and Debian, the following command will install the needed packages:

sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libgif-dev

Complete the installation (see below).

Mac OS X
. . . . . . . . . .

Trying to automate the compilation for all platforms sounds like a drag. How about replacing the build process with a simple fetch + extract of the appropriate binary package? Or even better include the binaries in the cwebp-bin repo to remove the direct dependency to Google?

We would then hit issues #11 on platforms where dynamic linking is used for precompiled binaries. I am not sure why that issue was closed: imho cwebp-bin should at the very least document the dependency in the README and warn during the installation that it is not met (when applicable, i.e. when NOT compiling from source AND when dynamic linking is used).

Finally, I think that issue #27 would also be addressed with the above.

cwebp error

⚠ Command failed: /var/www/doniai/production/source/node_modules/cwebp-bin/vendor/cwebp -version
/var/www/doniai/production/source/node_modules/cwebp-bin/vendor/cwebp: error while loading shared libraries: libXi.so.6: cannot open shared object file: No such file or directory

⚠ cwebp pre-build test failed
ℹ compiling from source
✖ Error: unexpected end of file
at Zlib.zlibOnError [as onerror] (zlib.js:168:17)

cwebp pre-build test failed

Jenkins log:

⚠ connect ETIMEDOUT 151.101.228.133:443
⚠ cwebp pre-build test failed
ℹ compiling from source
✔ cwebp built successfully

Error: [email protected] postinstall

Problem with npm install.

npm verb stack Exit status 1
npm verb stack at EventEmitter. (...\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
npm verb stack at emitTwo (events.js:126:13)
npm verb stack at EventEmitter.emit (events.js:214:7)
npm verb stack at ChildProcess. (...\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack at emitTwo (events.js:126:13)
npm verb stack at ChildProcess.emit (events.js:214:7)
npm verb stack at maybeClose (internal/child_process.js:925:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

As far as i can tell this is solved by the pullrequest in #21.
This only fails on a syntax issue for Node4. Can we get this fixed?

Please add environment variable to set bin download URL

like node-sass can set sass-binary-site to download bin library.

function getBinaryUrl() {
  var site = getArgument('--sass-binary-site') ||
             process.env.SASS_BINARY_SITE  ||
             process.env.npm_config_sass_binary_site ||
             (pkg.nodeSassConfig && pkg.nodeSassConfig.binarySite) ||
             'https://github.com/sass/node-sass/releases/download';

  return [site, 'v' + pkg.version, getBinaryName()].join('/');
}

For some reason in china download from github is very slow.

We usually install package from https://npm.taobao.org/mirrors

pngquant-bin: https://npm.taobao.org/mirrors/pngquant-bin/
mozjpeg-bin: https://npm.taobao.org/mirrors/mozjpeg-bin/
cwebp-bin: https://npm.taobao.org/mirrors/cwebp-bin/

Issue with bright hues image conversion

I haven't noticed much color loss with cweb-bin until using brighter hues like this pink in both JPG's and PNG's there tends to be some loss of color

This is the original
image

This is the WebP
image

Failed at the [email protected] postinstall script

Hi,

I tried to install cwebp-bin in my project but npm install command fails :

npm install [email protected]
Failed at the [email protected] postinstall script
no such file or directory, lstat '<path_to_my_project>/node_modules/cwebp-bin/~'

NB : same error for other versions

My Linux distrib :

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

Regards,
David

postinstall should exit with non-zero state

cwebp-bin has some magic included that runs in postinstall. However we have seen, also postinstall is running into errors, our npm ci process will just continue. We believe this is due to the fact that postinstall command in cwebp-bin does return an exit status of 0 even when it detects and reports problems.

Testcommand:

node_modules/cwebp-bin$ npm run postinstall; echo $?

See output "0" in the last line in the following log:

node_modules/cwebp-bin$ npm run postinstall; echo $?

> [email protected] postinstall /app/node_modules/cwebp-bin
> node lib/install.js

  ⚠ Command failed: /app/node_modules/cwebp-bin/vendor/cwebp -version
/app/node_modules/cwebp-bin/vendor/cwebp: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory


  ⚠ cwebp pre-build test failed
  ℹ compiling from source
  ✖ Error: Command failed: /bin/sh -c ./configure --disable-shared --prefix="/app/node_modules/cwebp-bin/vendor" --bindir="/app/node_modules/cwebp-bin/vendor"
configure: error: in `/tmp/1658b1d2-b733-4e2b-81b6-42a7c8912aa0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking for style of include used by make... none
checking for gcc... no
checking for cc... no
checking for cl.exe... no

    at Promise.all.then.arr (/app/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
0

Running command npm install gulp-webp --save-dev for error log as below

[email protected] postinstall c:\12810\gulp\webp.gzip.copy\node_modules\gulp-web
p\node_modules\imagemin-webp\node_modules\cwebp-bin
node lib/install.js

‼ unable to verify the first certificate
‼ cwebp pre-build test failed
i compiling from source
× Error: ./configure --disable-shared --prefix="c:\12810\gulp\webp.gzip.copy\n
ode_modules\gulp-webp\node_modules\imagemin-webp\node_modules\cwebp-bin\vendor"
--bindir="c:\12810\gulp\webp.gzip.copy\node_modules\gulp-webp\node_modules\image
min-webp\node_modules\cwebp-bin\vendor" && make && make install
Command failed: C:\Windows\system32\cmd.exe /s /c "./configure --disable-shared
--prefix="c:\12810\gulp\webp.gzip.copy\node_modules\gulp-webp\node_modules\image
min-webp\node_modules\cwebp-bin\vendor" --bindir="c:\12810\gulp\webp.gzip.copy\n
ode_modules\gulp-webp\node_modules\imagemin-webp\node_modules\cwebp-bin\vendor""

'.' is not recognized as an internal or external command,
operable program or batch file.

at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

cwebp-bin error on fresh install

I'm just copying this issue from imagemin-webp as the source of the problem was here.

The problem is fixable with the actions below, but thought it would be good to put here for anyone else encountering this problem as it is valid for any library using cwebp-bin, such as webp-converter


I'm getting the following error on a fresh installation.

/path/to/root/node_modules/cwebp-bin/vendor/cwebp: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory

imagemin-webp is implemented as follows:

  (async () => {
    const files = await imagemin([file], outputDirectory, {
    	use: [
    		imageminWebp({quality: 90})
    	]
    });
  })();

I've triple checked that both file and outputDirectory are valid - and they work fine if I use imagemin without imageminWebp.

OS is Ubuntu 18.04. Any suggestions?


I solved this by installing the following missing libraries:

apt-get install libglu1
apt-get install libxi6 libgconf-2-4
ldconfig

No idea why they are missing. This Ubuntu server is pretty vanilla.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.