Error with npm update: pngquant binary does not seem to work correctly
Asked Answered
A

5

29

I am getting the following error with my npm update command:

> [email protected] postinstall /var/www/pp/20180315202846/node_modules/pngquant-bin
> node lib/install.js

  ⚠ The `/var/www/pp/20180315202846/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 (/var/www/pp/20180315202846/node_modules/pngquant-bin/node_modules/got/index.js:111:21)
    at Object.onceWrapper (events.js:272:13)
    at ClientRequest.emit (events.js:180:13)
    at ClientRequest.onConnect (/var/www/pp/20180315202846/node_modules/pngquant-bin/node_modules/tunnel-agent/index.js:168:23)
    at Object.onceWrapper (events.js:272:13)
    at ClientRequest.emit (events.js:180:13)
    at Socket.socketOnData (_http_client.js:476:11)
    at Socket.emit (events.js:180:13)
    at addChunk (_stream_readable.js:269:12)
    at readableAddChunk (_stream_readable.js:256:11)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

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.

I already did:

 apt-get install libpng-dev

but I still get this error. Any ideas? (My distribution is Debian 9.2)

Armada answered 15/3, 2018 at 20:23 Comment(6)
Same issue popped up for me today.... Been building the same project for weeks multiple times a day and never had this error before today, but it's been most the day.Abode
@Abode if you find a solution, could you please tell me..Armada
Same issue popped up for me today.Cloudscape
i'm getting the same error. [email protected] postinstall: node lib/install.js` I'm using docker-alpine (3.4) node version 6.7.0 npm version 3.10.3Unite
The root issue is in pngquant-bin v4.0.0 github.com/imagemin/pngquant-bin/issues/78Cloudscape
It works for me try this: "[email protected]", "node.js version v9.9.0", "npm version 5.6.0"Winnah
L
36

For Ubuntu you need to run:

wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
  && sudo dpkg -i /tmp/libpng12.deb \
  && rm /tmp/libpng12.deb
Lewert answered 24/3, 2018 at 14:7 Comment(0)
R
14

Perhaps you will finds some help here at the original issue.

https://github.com/imagemin/pngquant-bin/issues/78

He is a suggested fix: (copy/paste from: https://github.com/imagemin/pngquant-bin/issues/78#issuecomment-374192838) As @velu76 and @sory19 said, I followed their method:

´sudo apt-get install libpng-dev´ ´npm install -g pngquant-bin´

Since I had already 'npm install' in my repo/project folder, I then ran ´sudo rm -rf node_modules´

then, still in my repository/project folder ´npm install --no-bin-links´

And it works right now.

I don't know if it's just a temporary fix, actually, but I can work for now.

Rohn answered 19/3, 2018 at 13:49 Comment(2)
Please don't just link to an external site. Include the relevant parts in your answer instead.Husbandman
I did just sudo apt-get install libpng-dev and re run npm install and it workedDoited
B
3

TLDR;
use node:latest instead of node:alpine for docker image


Hi, I was using docker image node:alpine and it crashes yesterday too. Seems to be a problem with some external package that laravel-mix requires. I tested on node:alpine node:8.10.0-alpine node:8.8.1-alpine nothing works. I tested laravel-mix 0.11.4 and 0.12.1 and 1.0 nothing works. But when I switch from node:alpine to node:latest, it works. Hope this helps

Backwoodsman answered 16/3, 2018 at 9:57 Comment(0)
T
0

You can fix this error by executing this command :

sudo npm install -g name-of-package --unsafe-perm=true --allow-root
Turboprop answered 21/9, 2018 at 10:52 Comment(0)
R
0

I was also facing same issue and tried all provided solutions but nothing works Issue on windows 10, Node 16, npm 8

but by downgrading my node to 14 and npm to 6 solve my problem.

Reimer answered 2/2, 2022 at 16:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.