本文介绍了错误:找不到所需的包装卷曲。请运行:install.packages('curl')在Travis CI上停止执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

R包运行良好(并通过了CRAN检查),但是当Travis CI运行单元测试时,它会出现

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

这似乎是Ubuntu特有的问题。我可以看到运行 sudo apt -get install libcurl4-openssl-dev 可以解决此问题。问题是我无法访问Ubuntu控制台(因为Travis CI在推送到git后会执行所有操作)-我可以将此代码放在某个地方吗?例如。能否以某种方式进入 .travis.yml ,如果可以,如何?

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?

当前的 .travis.yml 文件只有2行,看起来像这样

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

language: R
cache: packages



注意



基于问题/答案,我尝试调整 .travis.yml

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可以从生成日志中看到 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

我也尝试过

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

基于o n 建议,但存在相同的错误持续

Based on this suggestion, but the same error persisted

推荐答案

问题通过在导入中添加 curl 而消失了(即在 DESCRIPTION )中

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

例如

导入:dplyr,gsubfn,stringr,purrr,jsonlite,统计信息,lubridate,curl

如果您在 testthat 中有一个帮助文件,请不要忘记也将软件包加载到那里,即库(卷曲)。然后测试应该能够按预期运行

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

这篇关于错误:找不到所需的包装卷曲。请运行:install.packages('curl')在Travis CI上停止执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 06:52