pngquant-bin icon indicating copy to clipboard operation
pngquant-bin copied to clipboard

Can't install pngquant-bin on Ubuntu 16.04 (WSL)

Open xakep139 opened this issue 7 years ago • 14 comments

sudo npm install -g pngquant-bin@^3.0.0 output:

info lifecycle [email protected]~postinstall: [email protected]
verbose lifecycle [email protected]~postinstall: unsafe-perm in lifecycle false
verbose lifecycle [email protected]~postinstall: PATH: /usr/share/npm/bin/node-gyp-bin:/usr/local/lib/node_modules/pngquant-bin/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
verbose lifecycle [email protected]~postinstall: CWD: /usr/local/lib/node_modules/pngquant-bin
silly lifecycle [email protected]~postinstall: Args: [ '-c', 'node lib/install.js' ]
info lifecycle [email protected]~postinstall: Failed to exec postinstall script
verbose unlock done using /home/nikita/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
silly rollbackFailedOptional Starting
silly rollbackFailedOptional Finishing
silly runTopLevelLifecycles Starting
silly runTopLevelLifecycles Finishing
silly install printInstalled
verbose stack Error: [email protected] postinstall: `node lib/install.js`
verbose stack spawn ENOENT
verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:17:16)
verbose stack     at emitTwo (events.js:87:13)
verbose stack     at ChildProcess.emit (events.js:172:7)
verbose stack     at maybeClose (internal/child_process.js:821:16)
verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
verbose pkgid [email protected]
verbose cwd /home/nikita
error Linux 4.4.0-43-Microsoft
error argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "pngquant-bin@^3.0.0"
error node v4.2.6
error npm  v3.5.2
error file sh
error code ELIFECYCLE
error errno ENOENT
error syscall spawn
error [email protected] postinstall: `node lib/install.js`
error spawn ENOENT
error Failed at the [email protected] postinstall script 'node lib/install.js'.
error Make sure you have the latest version of node.js and npm installed.
error If you do, this is most likely a problem with the pngquant-bin package,
error not with npm itself.
error Tell the author that this fails on your system:
error     node lib/install.js
error You can get information on how to open an issue for this project with:
error     npm bugs pngquant-bin
error Or if that isn't available, you can get their info via:
error     npm owner ls pngquant-bin
error There is likely additional logging output above.
verbose exit [ 1, true ]

xakep139 avatar May 24 '17 02:05 xakep139

libpng-dev is installed

xakep139 avatar May 24 '17 02:05 xakep139

Have the same issue,

@xakep139 have you found a work around ?

alekaizer avatar Aug 01 '17 22:08 alekaizer

@alekaizer, nope. I've decided to replace package with pngquant-bin dependency with similar package without it

xakep139 avatar Aug 02 '17 05:08 xakep139

Type sudo apt-get install nodejs-legacy before sudo npm install -g pngquant-bin

Further reading: https://nodejs.org/en/download/package-manager/ A Node.js package is also available in the official repo for Debian Sid (unstable), Jessie (testing) and Wheezy (wheezy-backports) as "nodejs". It only installs a nodejs binary. The nodejs-legacy package installs a node symlink that is needed by many modules to build and run correctly. The Node.js modules available in the distribution official repositories do not need it.

DKurilo avatar Oct 31 '17 20:10 DKurilo

same problem here on ubuntu 17.10

root@latitude a$ sudo npm install pngquant
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

> [email protected] postinstall /root/a/node_modules/pngquant-bin
> node lib/install.js

  ⚠ The `/root/a/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✔ pngquant built successfully
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 305 packages from 128 contributors in 37.183s
root@latitude a$ sudo npm install pngquant-bin
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

> [email protected] postinstall /root/a/node_modules/pngquant/node_modules/pngquant-bin
> node lib/install.js

  ⚠ The `/root/a/node_modules/pngquant/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✔ pngquant built successfully

> [email protected] postinstall /root/a/node_modules/pngquant-bin
> node lib/install.js

  ⚠ The `/root/a/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✔ pngquant pre-build test passed successfully
  ✖ RequestError: pngquant failed to build, make sure that libpng-dev is installed
    at ClientRequest.req.once.err (/root/a/node_modules/got/index.js:111:21)
    at Object.onceWrapper (events.js:272:13)
    at ClientRequest.emit (events.js:180:13)
    at Socket.socketErrorListener (_http_client.js:394:9)
    at Socket.emit (events.js:180:13)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at process._tickCallback (internal/process/next_tick.js:114:19)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-03-16T08_18_52_426Z-debug.log

says make sure that libpng-dev is installed but the package is installed already

$ apt-get install libpng-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libpng-dev is already the newest version (1.6.34-1).
0 upgraded, 0 newly installed, 0 to remove and 103 not upgraded.

mdaliyan avatar Mar 16 '18 08:03 mdaliyan

@mdaliyan The above problem looks slightly different than yours. I think you're looking for issue 78.

anthonyaam avatar Mar 16 '18 15:03 anthonyaam

To build pngquant binary you need to have installed make. apt-get install make (or similar) Found viewing install.js [...]

binBuild.url('http://pngquant.org/pngquant-2.10.1-src.tar.gz', [
			'rm ./INSTALL',
			`./configure --prefix="${bin.dest()}"`,
			`make install BINPREFIX="${bin.dest()}"`

[..]

drzippie avatar Mar 17 '18 00:03 drzippie

It must be so @drzippie . I removed nodejs that was installed from repo and compiled it from source. Then I tried to install pngquant-bin, and it was installed without any problem.

mdaliyan avatar Mar 18 '18 10:03 mdaliyan

Hello @mdaliyan , I had a similar problem and fixed by installing libpng-dev with this command: sudo apt install libpng-dev

mehranabi avatar Mar 27 '18 14:03 mehranabi

grep-status -FProvides,Package -sPackage,Provides,Status libpng-dev Package: libpng12-dev Provides: libpng-dev, libpng12-0-dev, libpng3-dev Status: install ok installed

Still get: pngquant pre-build test passed successfully pngquant failed to build, make sure that libpng-dev is installed

[email protected] node.js version v9.9.0 npm version 5.6.0 Ubuntu 16.04 make 4.1-6 installed

any ideas?

gbryant200 avatar Mar 28 '18 19:03 gbryant200

After some debugging I found out that the error on my system (Ubuntu 18.04) was a permission error. My /tmp directory is mounted on a tmpfs. I was passing the noexec in my mount options in fstab, which resulted into ./configure (extracted into a temporary directory) was not executable.

If this is the case, remove noexec from the mount options in /etc/fstab. Then remount /tmp.

sudo mount -o rw,remount /tmp

I hope this helps!

remcohaszing avatar May 07 '18 10:05 remcohaszing

tried: sudo apt-get install -y build-essential libpng-dev ?

c2h2 avatar May 15 '18 05:05 c2h2

@c2h2 thank you it worked ❤

mehdilamaaffar avatar Jan 14 '19 10:01 mehdilamaaffar

Hello @mdaliyan , thank you. It worked for me. Ubuntu 18.04 Node v10.15.3 npm 6.4.1

gihandilanka-github avatar Jun 06 '19 08:06 gihandilanka-github