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

MaxRedirectsError when installing in node docker alpine #82

Open
frankshaka opened this issue Apr 26, 2018 · 2 comments
Open

MaxRedirectsError when installing in node docker alpine #82

frankshaka opened this issue Apr 26, 2018 · 2 comments

Comments

@frankshaka
Copy link

Steps to reproduce:

$ docker run --rm -it node:9.11.1-alpine sh -c 'apk -Uuv add bash lcms2-dev libpng-dev gcc g++ make autoconf automake && npm install -g pngquant-bin --allow-root --unsafe-perm=true'
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/33) Installing m4 (1.4.18-r0)
(2/33) Installing libbz2 (1.0.6-r5)
(3/33) Installing perl (5.24.3-r1)
(4/33) Installing autoconf (2.69-r0)
(5/33) Installing automake (1.15.1-r0)
(6/33) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(7/33) Installing ncurses-terminfo (6.0_p20171125-r0)
(8/33) Installing ncurses-libs (6.0_p20171125-r0)
(9/33) Installing readline (6.3.008-r5)
(10/33) Installing bash (4.3.48-r1)
Executing bash-4.3.48-r1.post-install
(11/33) Installing binutils-libs (2.28-r3)
(12/33) Installing binutils (2.28-r3)
(13/33) Installing gmp (6.1.2-r0)
(14/33) Installing isl (0.17.1-r0)
(15/33) Installing libgomp (6.3.0-r4)
(16/33) Installing libatomic (6.3.0-r4)
(17/33) Installing pkgconf (1.3.7-r0)
(18/33) Installing mpfr3 (3.1.5-r0)
(19/33) Installing mpc1 (1.0.3-r0)
(20/33) Installing gcc (6.3.0-r4)
(21/33) Installing musl-dev (1.1.16-r14)
(22/33) Installing libc-dev (0.7.1-r0)
(23/33) Installing g++ (6.3.0-r4)
(24/33) Installing libjpeg-turbo (1.5.1-r0)
(25/33) Installing libjpeg-turbo-dev (1.5.1-r0)
(26/33) Installing zlib-dev (1.2.11-r0)
(27/33) Installing tiff (4.0.9-r2)
(28/33) Installing tiff-dev (4.0.9-r2)
(29/33) Installing lcms2 (2.8-r1)
(30/33) Installing lcms2-dev (2.8-r1)
(31/33) Installing libpng (1.6.29-r1)
(32/33) Installing libpng-dev (1.6.29-r1)
(33/33) Installing make (4.2.1-r0)
Executing busybox-1.26.2-r9.trigger
OK: 46 packages, 816 dirs, 9675 files, 211 MiB
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
/usr/local/bin/pngquant -> /usr/local/lib/node_modules/pngquant-bin/cli.js

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

  ⚠ spawn /usr/local/lib/node_modules/pngquant-bin/vendor/pngquant ENOENT
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✔ pngquant pre-build test passed successfully
  ✖ MaxRedirectsError: pngquant failed to build, make sure that libpng-dev is installed
    at ClientRequest.fn.request.res (/usr/local/lib/node_modules/pngquant-bin/node_modules/got/index.js:69:23)
    at Object.onceWrapper (events.js:272:13)
    at ClientRequest.emit (events.js:180:13)
    at HTTPParser.parserOnIncomingClient (_http_client.js:540:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)
    at Socket.socketOnData (_http_client.js:445:20)
    at Socket.emit (events.js:180:13)
    at addChunk (_stream_readable.js:274:12)
    at readableAddChunk (_stream_readable.js:261:11)
    at Socket.Readable.push (_stream_readable.js:218:10)
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-04-26T11_30_41_696Z-debug.log
@frankshaka
Copy link
Author

Diagnostics:

Printing redirectUrls property of the error gives the following result:

[ 'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz',
  'https://pngquant.org/pngquant-2.10.1-src.tar.gz' ]

It is weird because curl https://pngquant.org/pngquant-2.10.1-src.tar.gz succeeds with no redirects. Any suggestions?

@frankshaka
Copy link
Author

It seems to be related with proxy. I actually use a local proxy server during installation. After removing the proxy environment, the error disappeared. I've submitted an issue for download module.

However, I suggest directly using https: version of the source pack download URL instead of the currently http: version since the redirect is 301 Moved Permanently.

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

1 participant