Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install pngquant fails #14

Closed
anthonyaam opened this issue Mar 15, 2018 · 20 comments
Closed

npm install pngquant fails #14

anthonyaam opened this issue Mar 15, 2018 · 20 comments

Comments

@anthonyaam
Copy link

I'm getting the below error when running npm install pngquant. Other users started getting this error today and have posted on stack overflow. Thank you for the help.

pngquant failed to build, make sure that libpng is installed

@papandreou
Copy link
Owner

I can't reproduce this (but I do have pngquant installed).

This is a problem with https://github.com/imagemin/pngquant-bin, which is a dependency of this package (pngquant), but it seems like they have just released a new version that changes some build-related things.

I updated to pngquant-bin@^4.0.0 now and released pngquant@2.0.0, could you try installing that instead?

@mdaliyan
Copy link

mdaliyan commented Mar 16, 2018

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.

@papandreou
Copy link
Owner

@mdaliyan, that sure looks odd. Could you try bringing it up with the pngquant-bin folks?

@mdaliyan
Copy link

mdaliyan commented Mar 16, 2018

I'm going to do that already. but the odd thing is i cannot install pngquant separately too.

sorry for the previous post. i ran them before npm init. i have updated it. see: imagemin/pngquant-bin#64 (comment)

@lejoss
Copy link

lejoss commented Mar 16, 2018

I'm getting the same error

screen shot 2018-03-16 at 10 29 53 am

I'm using docker-alpine (3.4)
node version 6.7.0
npm version 3.10.3

@anthonyaam
Copy link
Author

@papandreou @mdaliyan I believe this is the related pngquant-bin issue.

@mdaliyan
Copy link

mdaliyan commented Mar 18, 2018

My Ubuntu install was so fresh. I tried to compile nodejs instead of using the repo version. after that pngquant-bin installed correctly. It seems that the make package was not installed before I try to compile nodejs (see: imagemin/pngquant-bin#78)

@Suven
Copy link

Suven commented Jul 19, 2018

Just for others running into that issue:

The error-message might suggest otherwise, but also make sure you installed build-essentials. Obviously it can not build the binary from source without a compiler.

So for ubuntu/debian, try: sudo apt-get install build-essential libpng-dev

@davidsneal
Copy link

Thanks @Suven !! I tried dozens of other suggestions, this sorted it for me!

@t-iki
Copy link

t-iki commented Aug 4, 2018

It works!! Thanks a lot 😁 @Suven

@jmpache
Copy link

jmpache commented Sep 4, 2018

Thanks @Suven !

@kishan93
Copy link

Just for others running into that issue:

The error-message might suggest otherwise, but also make sure you installed build-essentials. Obviously it can not build the binary from source without a compiler.

So for ubuntu/debian, try: sudo apt-get install build-essential libpng-dev

thank you so much, this solved the issue for me.

@ryanbagwell
Copy link

This worked for me on CentOS 7:

yum install libpng12-devel

(note libpng12-devel instead of libpng-devel)

From imagemin/pngquant-bin#78

@Tochukz
Copy link

Tochukz commented Jan 14, 2019

Just for others running into that issue:

The error-message might suggest otherwise, but also make sure you installed build-essentials. Obviously it can not build the binary from source without a compiler.

So for ubuntu/debian, try: sudo apt-get install build-essential libpng-dev

Worked for me. Thanks

@praWINK
Copy link

praWINK commented Jun 3, 2019

Hi Guys,
I am also facing the same issue in my windows 8.1, can you please anyone give some ideas for windows???

@papandreou
Copy link
Owner

I'll close this as it was actually related to the pngquant-bin package.

@pauloantonelli
Copy link

Just for others running into that issue:

The error-message might suggest otherwise, but also make sure you installed build-essentials. Obviously it can not build the binary from source without a compiler.

So for ubuntu/debian, try: sudo apt-get install build-essential libpng-dev

thanks solved my problem!

@yassh-pandey
Copy link

Thanks a lot @Suven. This issue was making me go crazy. lol

@Junior-Shyko
Copy link

Apenas para outros que estão enfrentando esse problema:

A mensagem de erro pode sugerir o contrário, mas também verifique se você instalou o build-essentials. Obviamente ele não pode construir o binário a partir da fonte sem um compilador.

Então, para ubuntu/debian, tente:sudo apt-get install build-essential libpng-dev

Muito Obrigado pela dica.

@cunguyendev
Copy link

Confirm it worked on Linux 22, thanks @Suven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests