You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在R中安装PhantomJS后无法运行,求解决libssl_conf.so缺失问题

PhantomJS 与 RCrawler 配合使用时的 SSL 依赖错误解决方法

问题描述

通过 R 的 webshot 包安装 PhantomJS,执行命令:

webshot::install_phantomjs(force = TRUE)

安装完成后提示 PhantomJS 已安装到 /home/*******/bin 目录,进入该目录用 ls 确认文件存在,但执行 phantomjs 命令时出现如下 SSL 相关错误:

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() 时也出现相同错误,提示无法连接到 4830 端口,需解决该问题以配合 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      

解决步骤

1. 安装缺失的 SSL 配置库

错误提示找不到 libssl_conf.so,这是 OpenSSL 配置模块的依赖库,在 Pop!_OS 22.04 中执行以下命令安装:

sudo apt-get update
sudo apt-get install libssl-dev

2. 临时设置环境变量绕过 SSL 配置错误

如果安装后仍报错,可通过设置环境变量禁用 OpenSSL 的 ssl_conf 模块,终端执行:

export OPENSSL_CONF=/dev/null

之后再运行 phantomjs 测试是否正常。

3. 永久设置环境变量(可选)

若需每次启动终端自动应用该设置,将环境变量添加到用户配置文件:

echo "export OPENSSL_CONF=/dev/null" >> ~/.bashrc
source ~/.bashrc

4. 在 R 中指定 PhantomJS 路径并测试

确保 R 能找到正确的 PhantomJS 可执行文件,在 R 中执行:

# 指定 PhantomJS 路径
Sys.setenv(PHANTOMJS_PATH = "/home/*******/bin/phantomjs")
# 测试运行
webdriver::run_phantomjs()

若能正常启动,再尝试使用 RCrawler 进行爬取。

替代方案:使用 ChromeDriver 替代 PhantomJS

PhantomJS 已停止维护,若上述方法无效,可改用 ChromeDriver 配合 RCrawler:

  1. 安装 Chrome 浏览器和 ChromeDriver:
sudo apt-get install chromium-browser chromium-chromedriver
  1. 在 R 中配置 RCrawler 使用 ChromeDriver:
RCrawler::StartCrawler(
  URL = "目标网址",
  Browser = "chrome",
  ChromeDriverPath = "/usr/lib/chromium-browser/chromedriver"
)

内容的提问来源于stack exchange,提问作者Amarullazo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 04:33:25