Travis CI 错误而 devtools::chech() 没有

Travis CI error while devtools::chech() doesn't

Here is the package in github.

如您在 travis.yml 中所见,警告不会被视为错误。当我在控制台中执行 check() 时,没有错误。这是结果:

0 errors ✓ | 4 warnings x | 1 note x

这是特拉维斯的最后几行 CI。

ERROR: dependency ‘raster’ is not available for package ‘leaflet’
* removing ‘/home/travis/R/Library/leaflet’
* installing *source* package ‘modelr’ ...
** package ‘modelr’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (modelr)
* installing *source* package ‘tidyverse’ ...
** package ‘tidyverse’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (tidyverse)
The downloaded source packages are in
    ‘/tmp/RtmpX59PJA/downloaded_packages’
Warning messages:
1: In i.p(...) : installation of package ‘terra’ had non-zero exit status
2: In i.p(...) : installation of package ‘units’ had non-zero exit status
3: In i.p(...) : installation of package ‘raster’ had non-zero exit status
4: In i.p(...) : installation of package ‘sf’ had non-zero exit status
5: In i.p(...) :
  installation of package ‘leaflet’ had non-zero exit status
missing: terra, raster, units, leaflet, sf
The command "Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages()), collapse=", ")); q(status = 1, save = "no")}'" failed and exited with 1 during .
Your build has been stopped.

我应该修改什么才能让它通过 Travis CI?

我认为您的包裹至少取决于 rastersf;并且您的脚本没有安装它们:

1: In i.p(...) : installation of package ‘terra’ had non-zero exit status
2: In i.p(...) : installation of package ‘units’ had non-zero exit status
3: In i.p(...) : installation of package ‘raster’ had non-zero exit status
4: In i.p(...) : installation of package ‘sf’ had non-zero exit status

原因很可能是您没有安装所需的系统依赖项(GDAL、GEOS 等)。在安装这些包之前,你需要在你的系统中添加这样的东西

sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev netcdf-bin

我认为在 travis 文件中是这样的

addons:
  apt:
    packages:
      - libgdal-dev
      - libproj-dev
      - libudunits2-dev
      - netcdf-bin

您可能更喜欢使用 github 操作。参见例如这个 workflow 对于 terra