通过 Docker 在 Heroku 上部署闪亮的应用程序时切换将警告视为错误

如何解决通过 Docker 在 Heroku 上部署闪亮的应用程序时切换将警告视为错误

如何告诉 R 或 Docker 或 Heroku 在部署 Shiny/golem 应用时不要将警告视为错误

我想上周我已经找到了答案 - 在我的 Dockerfile 中类似于 ENV WARNINGS_ARE_ERRORS=false内容 - 但我似乎无法“重新找到”它,因为我的 Google 游戏今天完全失败了; -)

一些关键资源:

这就是我的 Dockerfile 在结构上的样子

FROM rocker/r-ver:4.0.4
ENV WARNINGS_ARE_ERRORS=false
RUN apt-get update && apt-get install -y  git-core libcurl4-openssl-dev libgit2-dev libicu-dev libpq-dev libssl-dev libxml2-dev make pandoc pandoc-citeproc && rm -rf /var/lib/apt/lists/*
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'),download.file.method = 'libcurl')" >> /usr/local/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN R -e 'remotes::install_github("r-lib/remotes",ref = "97bbf81")'
RUN Rscript -e 'remotes::install_version("shiny",upgrade="never",version = "1.5.0")'
RUN Rscript -e 'remotes::install_version("golem",version = "0.2.1")'

[...]

RUN Rscript -e 'remotes::install_github("rappster/confx")'
RUN mkdir /build_zone
ADD . /build_zone
workdir /build_zone
RUN R -e 'remotes::install_local(upgrade="never")'
CMD R -e "options('shiny.port'=$PORT,shiny.host='0.0.0.0');mypkg::run_app()"

这是我遇到的错误的警告:

[...]

Step 25/30 : RUN Rscript -e 'remotes::install_github("rappster/confx")'
 ---> Running in f50d3dd800cb
Downloading GitHub repo rappster/confx@master
valid (NA -> 3f09feea8...) [GitHub]
Downloading GitHub repo rappster/valid@master
Running `R CMD build`...
* checking for file ‘/tmp/RtmpKWNYfH/remotes77dbc946c/rappster-valid-3f09fee/DESCRIPTION’ ... OK
* preparing ‘valid’:
* checking DESCRIPTION Meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘valid_0.0.0.9001.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘valid’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** 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 (valid)
Running `R CMD build`...
* checking for file ‘/tmp/RtmpKWNYfH/remotes76bee127a/rappster-confx-e53517f/DESCRIPTION’ ... OK
* preparing ‘confx’:
* checking DESCRIPTION Meta-information ... OK
* installing the package to process help pages
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘confx_0.0.0.9024.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘confx’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Warning: replacing prevIoUs import ‘magrittr::set_names’ by ‘purrr::set_names’ when loading ‘confx’
** help
Error : (converted from warning) /tmp/RtmpqApPd2/R.INSTALL11445cdd308/confx/man/grapes-not-in-grapes.Rd: \name should not contain !,| or @
ERROR: installing Rd objects Failed for package ‘confx’
* removing ‘/usr/local/lib/R/site-library/confx’
Error in i.p(...) : 
  (converted from warning) installation of package ‘/tmp/RtmpKWNYfH/file75a06ee6c/confx_0.0.0.9024.tar.gz’ had non-zero exit status
Calls: <Anonymous> ... with_rprofile_user -> with_envvar -> force -> force -> i.p
Execution halted
The command '/bin/sh -c Rscript -e 'remotes::install_github("rappster/confx")'' returned a non-zero code: 1
 ▸    Error: docker build exited with Error: 1

解决方法

在一次一页地浏览我的搜索历史后,我能够再次将其拼凑起来。

原来问题是由 {remotes} 引起的,可以通过添加来解决

ENV R_REMOTES_NO_ERRORS_FROM_WARNINGS=true

到您的 Dockerfile(请参阅相关 GitHub issue

添加环境变量

R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE

到您的 .Renviron 文件也可能有效,但尚未测试。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?