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

fails inside a docker container #57

Closed
dciccale opened this issue Apr 29, 2015 · 14 comments
Closed

fails inside a docker container #57

dciccale opened this issue Apr 29, 2015 · 14 comments

Comments

@dciccale
Copy link

fails inside a docker container created from node:latest

root@d06adbb5fa5c:/home/app# gulp imagemin
[07:45:43] Using gulpfile /home/app/gulpfile.js
[07:45:43] Starting 'imagemin'...

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: Command failed: /home/app/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/d3fd1a87-7e45-4d50-bf61-30c1c6911a31 /tmp/4a577168-c7f5-4eac-8fc8-44944cee6894
/home/app/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/vendor/optipng: 6: /home/app/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/vendor/optipng: Syntax error: newline unexpected

    at ChildProcess.exithandler (child_process.js:751:12)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Socket.<anonymous> (child_process.js:1183:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:485:12)
@kevva
Copy link
Member

kevva commented Apr 29, 2015

#41

@dciccale
Copy link
Author

i updated npm inside the container and re-installed imagemin dep and it worked thx

@dciccale
Copy link
Author

it only works if i manually install imagemin inside the container i will have to include that in the dockerfile do you think of another better solution?

@kevva
Copy link
Member

kevva commented Apr 29, 2015

Never worked with imagemin using docker so unfortunately, no.

@treejanitor
Copy link

@dciccale Hmm, I hit the same issue with docker... I tried to manually install imagemin in the container but didn't have any luck with getting past the newline unexpected issue. What did you do exactly? I tried npm install -g imagemin

@dciccale
Copy link
Author

@treejanitor i am using gulp-imagemin which uses this module, what I did in my Dockerfile is RUN npm update -g npm && npm install gulp-imagemin and it worked.

@treejanitor
Copy link

@dciccale Thanks - I'm using grunt, but hopefully it'll be the same... I'll give it a shot.

@treejanitor
Copy link

@dciccale I couldn't get this to work for the life of me... the issue is inside optipng-bin for some reason. I just am going to skip crunching pngs for now. I installed via RUN npm update -g npm && npm install grunt-contrib-min and also tried RUN npm update -g npm && npm install optipng-bin in the same way you did, but had no luck. Thanks for the tip though.

@lenybernard
Copy link

@treejanitor did you figured out why it was failing ? I also experiencing this issue with a grunt app

@manchuck
Copy link

I was able to workaround this issue by switching to the node:6-wheezy container. seems that by default, node:6 was built using the jessie ubuntu. This package appears to have issues running on that flavor

@kevinkarwaski
Copy link

@manchuck you saved my day! Thanks for the wheezy tip, worked like a charm.

@manchuck
Copy link

manchuck commented May 25, 2016

@kevinkarwaski Seems that jessie ubuntu is using an ARM processor. Something compiled along the way is causing issues. Still have not gone through to figure out why that could be causing this issue.

@dpayne9000
Copy link

thanks breh

@CITguy
Copy link

CITguy commented Sep 13, 2016

I just ran into this issue. I discovered that my docker setup was copying compiled npm binaries from my host to the guest container. However, you cannot guarantee that a container's cpu architecture will match that of your host. So, to avoid this issue, I would recommend adding node_modules/ to a .dockerignore file so that the host-compiled binaries are not transferred to the guest.

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

8 participants