Medium / phantomjs

NPM wrapper for installing phantomjs
Other
1.42k stars 435 forks source link

Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js' #659

Closed avtaniket closed 7 years ago

avtaniket commented 7 years ago

Server configuration :

Docker file:

FROM ubuntu:14.04
FROM node:argon

# Create app directory
RUN mkdir -p /myapp
WORKDIR  /myapp

# Install app dependencies
COPY package.json /myapp
RUN npm install

Error log

  npm ERR! Linux 4.4.35-33.55.amzn1.x86_64
  npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
  npm ERR! node v4.7.0
  npm ERR! npm  v2.15.11
  npm ERR! code ELIFECYCLE
  
  npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js'.
  npm ERR! This is most likely a problem with the phantomjs-prebuilt package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     node install.js
  npm ERR! You can get information on how to open an issue for this project with:
  npm ERR!     npm bugs phantomjs-prebuilt
  npm ERR! Or if that isn't available, you can get their info via:
  npm ERR! 
  npm ERR!     npm owner ls phantomjs-prebuilt
  npm ERR! There is likely additional logging output above.
  npm info preuninstall phantomjs-prebuilt@2.1.14
  npm info uninstall phantomjs-prebuilt@2.1.14
  npm info postuninstall phantomjs-prebuilt@2.1.14
  npm info preuninstall phantomjs-prebuilt@2.1.14
  npm info uninstall phantomjs-prebuilt@2.1.14
  npm info postuninstall phantomjs-prebuilt@2.1.14
  npm info preuninstall phantom@2.1.21
  npm info uninstall phantom@2.1.21
  npm info postuninstall phantom@2.1.21
  
  npm ERR! Please include the following file with any support request:
  npm ERR!     /myapp/npm-debug.log
  The command '/bin/sh -c npm install' returned a non-zero code: 1
  Failed to build Docker image aws_beanstalk/staging-app:  with any support request:
  npm ERR!     /myapp/npm-debug.log
  The command '/bin/sh -c npm install' returned a non-zero code: 1. Check snapshot logs for details. (Executor::NonZeroExitStatus)
joswhite commented 7 years ago

I have the same problem. I'm running npm i phantomjs-prebuilt from a clean install of a node:6.9.2-slim Docker image. The installation worked 12/16/2016, but fails today:

root@56a0beae8807:/usr/app# npm i phantomjs-prebuilt

> phantomjs-prebuilt@2.1.14 install /usr/app/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
  [======================------------------] 55%
Received 22866K total.
Extracting tar contents (via spawned process)
Error extracting archive
Phantom installation failed { Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
  killed: false,
  code: 2,
  signal: null,
  cmd: 'tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2' } Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_6
4.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
npm WARN app@1.0.0 No description
npm WARN app@1.0.0 No repository field.
npm ERR! Linux 4.4.27-moby
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "phantomjs-prebuilt"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs phantomjs-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/app/npm-debug.log
joswhite commented 7 years ago

Running apt-get -qq update && apt-get -qq -y install bzip2 before installing phantomjs is a possible workaround. It worked for me.

avtaniket commented 7 years ago

It doesn't work for me, any suggestions.

Also tried with node v 4.7

otaviomedeiros commented 7 years ago

Same problem here.

otaviomedeiros commented 7 years ago

I just got it working by installing phantomjs before the rest of the packages.

COPY package.json .
RUN npm install phantomjs-prebuilt 
RUN npm install
stevegrunwell commented 7 years ago

Can confirm that @joswhite's fix worked for me as well; the container I was using for my DeployBot builds (not the stock container, FWIW) apparently didn't have bzip2, so I added the following to my build commands:

apt-get install -y bzip2
KasperBrandt commented 7 years ago

Same here, @joswhite's fix worked.

oamado commented 7 years ago

I did that @joswhite said and I update nodejs. I was running node v 4.6. With the latest version it works

avtaniket commented 7 years ago

@otaviomedeiros Thanks,

It working by installing phantomjs before the rest of the packages

# Install app dependencies
COPY package.json /iconapp
RUN npm install phantomjs-prebuilt
RUN npm install
petermikitsh commented 7 years ago

The resolution is the same for CentOS -- Installing bzip2 solved the issue.

FagnerMartinsBrack commented 7 years ago

Running npm install phantomjs-prebuilt before installing the rest of the dependencies is a valid workaround but it doesn't fix the issue.

Why was this issue closed?

ralfe commented 7 years ago

I agree with @FagnerMartinsBrack . This workaround is not a valid solution! Please reopen this issue.

tuliobluz commented 7 years ago

@joswhite fix worked!

codinglobster commented 7 years ago

here's my solution: download https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip then put it into C:\Users\Administrator\AppData\Local\Temp\phantomjs then npm install phantomjs-prebuilt finnally npm i, that fix mine on windows

gooin commented 7 years ago

@codinglobster's solution is work

SkinnerJL commented 7 years ago

This worked for me as well: yum install -y bzip2 except I was obviously on CentOS.

SaidMarar commented 7 years ago

@codinglobster IT WORKED !

MonFig commented 7 years ago

npm install phantomjs-prebuilt@2.1.14 --ignore-scripts

codinglobster commented 7 years ago

@MonFig this kind of solution just work for this issue,it may cause the sequence of errors,when you use one generator to generate codes you will find some dependency errors,just because you "ignore some scripts"

darkn3rd commented 7 years ago

I ran into this with debian:jessie images, but not ubuntu:trusty images. Is there a way to show some sort of helpful message if a system package is required for the npm module to work?

scherler commented 7 years ago

RUN apt-get -qq update && apt-get -qq -y install bzip2 before the npm i works for me and hints that simply bzip2 is missing in the images used (mine node:slim) so the fix IMHO is to open PR in the images and add bzip2to the defaults, right?

....or not depend on bzip2 in the first place, which is as well a valid solution to the underlying issue.

kkilton commented 6 years ago

https://github.com/Medium/phantomjs says to go here npm install phantomjs-prebuilt --phantomjs_cdnurl=https://bitbucket.org/ariya/phantomjs/downloads. This worked for me. I ran npm install again to make sure

lucasvc commented 5 years ago

Sorry for resurrecting the thread, but none of the solutions proposed worked for me, and always a new error appeared. But I got the error at the end: I was building on a shared Docker volume (between Windows > Linux). After building in a native folder of the container worked as a charm the bzip2 solution.

mathieuduperre commented 5 years ago

had the same problem, bzip2 fixed it but definitely a work around