在R中安装PhantomJS

kknvjkwl  于 2023-07-31  发布在  其他
关注(0)|答案(1)|浏览(182)

我尝试使用webshot包安装PhantomJS,所以我在我的机器上运行以下命令:

webshot::install_phantomjs(force = TRUE)

字符串
在安装过程结束时,我得到以下内容:

phantomjs has been installed to /home/*******/bin


我转到该路由并使用ls命令确保phantomjs在那里。当我在该目录中输入phantomjs时,我得到以下内容:

Auto configuration failed
140184250763200:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio
140184250763200:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
140184250763200:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
140184250763200:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf


这与我在R(webdriver::run_phantomjs())中输入以下内容时得到的结果相同。

phantom.js started, but cannot connect to it on port 4830. stdout + stderr:
>  Auto configuration failed
>  140690466219968:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio
>  140690466219968:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
>  140690466219968:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
>  140690466219968:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf


我的目标是将phantomjs与RCrawler包结合使用,但这是必要的步骤。任何帮助都非常感谢。

sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=es_ES.UTF-8       LC_NUMERIC=C               LC_TIME=es_ES.UTF-8       
 [4] LC_COLLATE=es_ES.UTF-8     LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=es_ES.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       

time zone: America/Lima
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] webshot_0.5.5    Rcrawler_0.1.9-1

loaded via a namespace (and not attached):
 [1] jsonlite_1.8.7    compiler_4.3.0    selectr_0.4-2     crayon_1.5.2     
 [5] promises_1.2.0.1  Rcpp_1.0.11       xml2_1.3.5        webshot2_0.1.0   
 [9] stringr_1.5.0     parallel_4.3.0    callr_3.7.3       later_1.3.1      
[13] png_0.1-8         fastmap_1.1.1     showimage_1.0.0   R6_2.5.1         
[17] curl_5.0.0        iterators_1.0.14  rlang_1.1.1       websocket_1.4.1  
[21] stringi_1.7.12    webdriver_1.0.6   doParallel_1.0.17 debugme_1.1.0    
[25] cli_3.6.1         withr_2.5.0       magrittr_2.0.3    ps_1.7.5         
[29] foreach_1.5.2     processx_3.8.2    rstudioapi_0.14   base64enc_0.1-3  
[33] lifecycle_1.0.3   chromote_0.1.1    glue_1.6.2        data.table_1.14.8
[37] codetools_0.2-18  httr_1.4.6        tools_4.3.0

6kkfgxo0

6kkfgxo01#

尝试为phantomjs可执行文件添加 Package 脚本:

  • 将当前的~/bin/phantomjs重命名为~/bin/phantomjs.bin
  • 创建一个新的shell脚本并将其保存为~/bin/phantomjs
#!/bin/sh
export OPENSSL_CONF=/dev/null
exec ~/bin/phantomjs.bin "$@"

字符串

  • 使其可执行:chmod +x ~/bin/phantomjs

RCrawler现在应该执行 Package 器,phantomjs应该选择OPENSSL_CONF

相关问题