Error: Required package curl not found. Please run: install.packages('curl') Execution halted on Travis CI

﹥>﹥吖頭↗ 提交于 2019-12-11 17:26:13

问题


An R package works fine (and passes CRAN checks), but when Travis CI runs unit tests it errors with

Error: Required package curl not found. Please run: install.packages('curl')
Execution halted

This seems to be an issue particular to Ubuntu. I can see here that running sudo apt-get install libcurl4-openssl-dev can fix the issue. The trouble is I don't have access to the Ubuntu console (as Travis CI does everything after I push to git) - can I place this code somewhere? E.g. can it go in .travis.yml somehow, and if so, how?

The current .travis.yml file is just 2 lines and looks like this

language: R
cache: packages

Note

Based on this question/answer, I tried adjusting .travis.yml to

language: R
cache: packages
before_install:
  - sudo apt-get install libcurl4-openssl-dev

I can see from the build logs that sudo apt-get install libcurl4-openssl-dev ran, but the build errored in the same way as before regardless

Also note

I also tried

language: R
cache: packages
before_install:
    -sudo apt-get update

Based on this suggestion, but the same error persisted


回答1:


The problem went away by adding curl to imports (i.e. in DESCRIPTION)

e.g.

Imports: dplyr, gsubfn, stringr, purrr, jsonlite, stats, lubridate, curl

If you have a helper file in testthat, don't forget to load the package there too i.e. simply library(curl). Then the tests should be able to run as expected



来源:https://stackoverflow.com/questions/56345639/error-required-package-curl-not-found-please-run-install-packagescurl-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!