Closed wch closed 4 years ago
Not sure this fully works. I successfully installed phantomjs using webshot::install_phantomjs()
on both Windows and Ubuntu. But I tried installing it in Docker (from the r-ver
image) after restoring an {renv}
snapshot with the following commands.
RUN Rscript -e "renv::load('/home/${PROJ_NAME}')" -e "renv::restore(confirm=FALSE)" -e "install.packages('webshot')" -e "webshot::install_phantomjs()"
And that results in the following error.
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/bin/tar: Child returned status 2
/bin/tar: Error is not recoverable: exiting now
Error in webshot::install_phantomjs() :
Unable to install PhantomJS to any of these dirs: ~/bin, /root/.local/share/renv/cache/v4/R-3.6/x86_64-pc-linux-gnu/webshot/0.5.2/a9c10d391ebf2344939895cc6caca825/webshot/PhantomJS
In addition: Warning messages:
1: In utils::untar(zipfile) :
‘/bin/tar -xf 'phantomjs-2.1.1-linux-x86_64.tar.bz2'’ returned error code 2
2: In file.copy(exec, destdir, overwrite = TRUE) :
problem copying phantomjs-2.1.1-linux-x86_64/bin/phantomjs to /root/bin/phantomjs: No such file or directory
3: In file.copy(exec, destdir, overwrite = TRUE) :
problem copying phantomjs-2.1.1-linux-x86_64/bin/phantomjs to /root/.local/share/renv/cache/v4/R-3.6/x86_64-pc-linux-gnu/webshot/0.5.2/a9c10d391ebf2344939895cc6caca825/webshot/PhantomJS/phantomjs: No such file or directory
Execution halted
Looks like it's a file permission issue.
Yes, I know treating a folder in /home
as a project folder probably is not ideal, but I don't think that's the problem.
@jaredlander I think maybe the docker image needs to have bzip2?
@wch well what do you know, a simple fix I could have realized by more thoroughly reading the error. Thanks for pointing it out. Will now proceed to see if the whole setup works.
With
install_phantomjs(force=TRUE)
, if callingphantomjs --version
results in an error, then it would fail to install a new version of phantomjs. This fixes the logic so that ifforce
is TRUE, then it won't check the old version.