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

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

Open xakep139 opened 7 years ago

xakep139 commented 7 years ago

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

info lifecycle pngquant-bin@3.1.1~postinstall: pngquant-bin@3.1.1
verbose lifecycle pngquant-bin@3.1.1~postinstall: unsafe-perm in lifecycle false
verbose lifecycle pngquant-bin@3.1.1~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 pngquant-bin@3.1.1~postinstall: CWD: /usr/local/lib/node_modules/pngquant-bin
silly lifecycle pngquant-bin@3.1.1~postinstall: Args: [ '-c', 'node lib/install.js' ]
info lifecycle pngquant-bin@3.1.1~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: pngquant-bin@3.1.1 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 pngquant-bin@3.1.1
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 pngquant-bin@3.1.1 postinstall: `node lib/install.js`
error spawn ENOENT
error Failed at the pngquant-bin@3.1.1 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 commented 7 years ago

libpng-dev is installed

alekaizer commented 7 years ago

Have the same issue,

@xakep139 have you found a work around ?

xakep139 commented 7 years ago

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

DKurilo commented 6 years ago

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.

mdaliyan commented 6 years ago

same problem here on ubuntu 17.10

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

> pngquant-bin@3.1.1 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 a@1.0.0 No description
npm WARN a@1.0.0 No repository field.

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

> pngquant-bin@3.1.1 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

> pngquant-bin@4.0.0 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 a@1.0.0 No description
npm WARN a@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pngquant-bin@4.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pngquant-bin@4.0.0 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.
anthonyaam commented 6 years ago

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

drzippie commented 6 years ago

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()}"`

[..]

mdaliyan commented 6 years ago

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.

mehranabi commented 6 years ago

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

gbryant200 commented 6 years ago

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

pngquant-bin@4.0.0 node.js version v9.9.0 npm version 5.6.0 Ubuntu 16.04 make 4.1-6 installed

any ideas?

remcohaszing commented 6 years ago

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!

c2h2 commented 6 years ago

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

mehdilamaaffar commented 5 years ago

@c2h2 thank you it worked ❤

gihandilanka-github commented 5 years ago

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