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

1

1

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

Coolie answered 28/5, 2019 at 15:34 Comment(0)
C
0

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

Coolie answered 28/5, 2019 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.