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

phantom's installation of phantomjs won't start on Docker/Linux container #619

Closed
ckundo opened this Issue Feb 27, 2017 · 8 comments

Comments

6 participants
@ckundo
Copy link

ckundo commented Feb 27, 2017

Expected behavior

When I include phantom as a dependency, and I require it to invoke phantomjs command, then phantomjs should load from the correct file path and run.

Actual behavior

When I include phantom in my project as a dependency and then use it to invoke a phantomjs action, I get an error:

error: Could not spawn [/usr/app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs] executable. Please make sure phantomjs is installed correctly.

Steps to reproduce the behavior

  1. npm install -g accesslint-cli on a linux environment
  2. accesslint https://www.accesslint.com
error: Could not spawn [/usr/lib/node_modules/accesslint-cli/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs] executable. Please make sure phantomjs is installed correctly.

Environment

  • OS: Alpine Linux 3.5 running in a Docker container (Docker 1.13.1 on Ubuntu 16.04)
  • Node version (node -v): v6.9.2
  • package version: 2.1.2

Notes

This may be related to #514, and might be resolved by updating phantomjs-prebuilt to 2.1.9.

@ckundo

This comment has been minimized.

Copy link

ckundo commented Feb 27, 2017

Not 100% sure, but this issue may be due to being on a 64 bit environment trying to run phantomjs compiled for 32 bit architecture. Investigating more.

@ckundo

This comment has been minimized.

Copy link

ckundo commented Feb 27, 2017

This turned out to be an issue with phantomjs not compiling correctly in Alpine Linux (see sgerrand/alpine-pkg-glibc#13). Solution was to install an Alpine specific package: https://github.com/Overbryd/docker-phantomjs-alpine/releases/tag/2.11

@ckundo ckundo closed this Feb 27, 2017

@beeman

This comment has been minimized.

Copy link

beeman commented Mar 18, 2017

Got here via Google, the command linked above does not seem to work with the node-alpine images because there is no curl installed.

This command works for me:

RUN apk update && apk add --no-cache fontconfig curl && \
  mkdir -p /usr/share && \
  cd /usr/share \
  && curl -L https://github.com/Overbryd/docker-phantomjs-alpine/releases/download/${PHANTOM_VERSION}/phantomjs-alpine-x86_64.tar.bz2 | tar xj \
  && ln -s /usr/share/phantomjs/phantomjs /usr/bin/phantomjs \
  && phantomjs --version
@daaain

This comment has been minimized.

Copy link

daaain commented Aug 25, 2017

Same as @beeman, but I also had a problem with a weird curl error message ("curl: (48) An unknown option was passed in to libcurl"), so had to add curl-dev 🙄

RUN apk update && apk add --no-cache fontconfig curl curl-dev && \
  mkdir -p /usr/share && \
  cd /usr/share \
  && curl -L https://github.com/Overbryd/docker-phantomjs-alpine/releases/download/2.11/phantomjs-alpine-x86_64.tar.bz2 | tar xj \
  && ln -s /usr/share/phantomjs/phantomjs /usr/bin/phantomjs \
  && phantomjs --version
@wader

This comment has been minimized.

Copy link

wader commented Nov 19, 2018

I had problem with phantomjs hanging on all script. This versions worked better for me ariya/phantomjs#14186 (comment)

@sudeepdk

This comment has been minimized.

Copy link

sudeepdk commented Nov 30, 2018

This will work 100 % -- follow this it worked for me ...

https://www.vultr.com/docs/how-to-install-phantomjs-on-ubuntu-16-04

@amir20

This comment has been minimized.

Copy link
Owner

amir20 commented Nov 30, 2018

For all those who end up here, there is an example Dockerfile at https://github.com/amir20/phantomjs-node/blob/master/examples/Dockerfile. It's a little old but still works.

@beeman

This comment has been minimized.

Copy link

beeman commented Nov 30, 2018

Thanks for sharing Amir! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment