imagemin / optipng-bin

optipng bin-wrapper that makes it seamlessly available as a local dependency
http://optipng.sourceforge.net
MIT License
97 stars 65 forks source link

Fails in docker Container #59

Open impguard opened 8 years ago

impguard commented 8 years ago

Referencing #57.

This still seems to have a problem inside a Docker container. I'm running a debian docker container with the polymer starter kit which uses the gulp-imagemin plugin. This seems to fail with this output:

Unhandled rejection Error: Command failed: /opt/rift/node_modules/gulp-
imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-
bin/vendor/optipng -strip all -clobber -force -fix -o 2 -out /tmp/06bbcf19-f1ad-454f-bd52-
7acad3cd4a94 /tmp/4b6a19b5-9f49-47ec-a120-aee0634017dd
/opt/rift/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-
optipng/node_modules/optipng-bin/vendor/optipng: 6: /opt/rift/node_modules/gulp-
imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-
bin/vendor/optipng: Syntax error: newline unexpected

The various solutions pointed out in #57 seems to not fix the problem.

vvu commented 8 years ago

I had the same issue occur. Turns out it was because I had installed the gulp-imagemin module on my host machine in a folder I was sharing with the container. I ended up deleting the node_modules folder on my host machine and installing the modules inside the docker container instead, which fixed the error.

fabiomontefuscolo commented 8 years ago

I got this message after enabling verbose log in npm. I don't if I should try to solve this on my dockers or if is a good idea inspect what happens when we try to spawn a curl process.

npm info lifecycle optipng-bin@3.0.3~postinstall: optipng-bin@3.0.3

> optipng-bin@3.0.3 postinstall /home/helllab/repository/myproject-dev/node_modules/optipng-bin
> node lib/install.js

#
# Fatal error in heap setup
# Allocation failed - process out of memory
#

Illegal instruction (core dumped)
npm verb lifecycle optipng-bin@3.0.3~postinstall: unsafe-perm in lifecycle true
npm verb lifecycle optipng-bin@3.0.3~postinstall: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/helllab/repository/myproject-dev/node_modules/optipng-bin/node_modules/.bin:/home/helllab/repository/myproject-dev/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
npm verb lifecycle optipng-bin@3.0.3~postinstall: CWD: /home/helllab/repository/myproject-dev/node_modules/optipng-bin
npm sill lifecycle optipng-bin@3.0.3~postinstall: Args: [ '-c', 'node lib/install.js' ]
npm sill lifecycle optipng-bin@3.0.3~postinstall: Returned: code: 132  signal: null
npm info lifecycle optipng-bin@3.0.3~postinstall: Failed to exec postinstall script
npm verb unlock done using /home/helllab/.npm/_locks/staging-c7f2061a851f975a.lock for /home/helllab/repository/myproject-dev/node_modules/.staging

Well, compile C code inside docker may be a bad idea. I will create a docker image with optipng-bin inside. It shoud solve the problem.

rxgx commented 8 years ago

I was copying my project directory to the Docker container and received the same error. I fixed it by ignoring the optipng-bin module in node_modules.