Closed avtaniket closed 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
Running apt-get -qq update && apt-get -qq -y install bzip2
before installing phantomjs is a possible workaround. It worked for me.
It doesn't work for me, any suggestions.
Also tried with node v 4.7
Same problem here.
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
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
Same here, @joswhite's fix worked.
I did that @joswhite said and I update nodejs. I was running node v 4.6. With the latest version it works
@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
The resolution is the same for CentOS -- Installing bzip2
solved the issue.
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?
I agree with @FagnerMartinsBrack . This workaround is not a valid solution! Please reopen this issue.
@joswhite fix worked!
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
@codinglobster's solution is work
This worked for me as well: yum install -y bzip2 except I was obviously on CentOS.
@codinglobster IT WORKED !
npm install phantomjs-prebuilt@2.1.14 --ignore-scripts
@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"
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?
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 bzip2
to the defaults, right?
....or not depend on bzip2
in the first place, which is as well a valid solution to the underlying issue.
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
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.
had the same problem, bzip2 fixed it but definitely a work around
Server configuration :
Docker file:
Error log