laravel-mix: Cannot deploy my app using laravel-mix since 3 days due to exiting code on pngquant lib
- Laravel Mix Version: 2.1.1
- Node Version (
node -v): 9.6.1 - NPM Version (
npm -v): 5.6.0 - OS: Debian
Since 3 days, it’s impossible for me to use Laravel Mix to deploy my application. The problem is that Laravel Mix requires pngquant library and this library has been updated 3 days ago by adding a line to exit the process when an error occurs! It means that all next npm packages cannot be installed. I don’t know if laravel-mix can modify something but the problem is very boring.
Linked to open issue: https://github.com/imagemin/pngquant-bin/issues/78
Here is the stack trace that occurs:
pngquant-bin@4.0.0 postinstall /var/www/palm/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: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
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.
^C
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-03-15T20_19_09_479Z-debug.log
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 13
- Comments: 19
Commits related to this issue
- :construction: Install missing binary for Laravel-mix See https://github.com/JeffreyWay/laravel-mix/issues/1539#issuecomment-374107064 — committed to lorisleiva/laravel-docker by lorisleiva 6 years ago
- :construction: Add dependencies for pngquant See https://github.com/JeffreyWay/laravel-mix/issues/1539#issuecomment-380725879 — committed to lorisleiva/laravel-docker by lorisleiva 6 years ago
For those having problems with Ubuntu. Try: 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
The issue comes from new release of
imagemin-pngquantv5.1 requirespngquant-bin@4.0.0The quick fix is to downgradeimagemin-pngquantto 5.0.* which requirespngquant-bin@3.1.1Run this command and commit your package.json
npm install --save-exact imagemin-pngquant@5.0.*Same issue on alpine. Fixed by installing:
I had similar issues, the workaround has been as what I explained in my comment:
I got similiar error for Laravel in Ubuntu 17.10. I used @sory19 method as below: I had the same issue but it is resolved by first installing libpng-dev Need to follow the following steps:
sudo apt-get install libpng-devand then runnpm install -g pngquant-binStill had same error. This is what I did.
Removed the “node_modules” folder:
sudo rm -rf node_modulesRe-rannpm installAnd it worked after that.Ubuntu 18.04… Had same problem. “Fixed” issue by piecing together some posts from above @softwaredeveloperca and @ngoctp :
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
run npm install --save-exact imagemin-pngquant@5.0.* in your web root.
run npm install in your web root.
@btica-ro I think you are my new favourite person - thanks (y)
I was missing g++
Thanks a lot @btica-ro!