简体   繁体   English

部署到Shinyapps.io时出错

[英]Error in deployment to shinyapps.io

The following is the error i received: 以下是我收到的错误:

Loading required package: tmap
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘tmap’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages(p) :
  'lib = "/usr/local/lib/R/site-library"' is not writable
Error in value[[3L]](cond) : unable to install packages
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

The following is my code: 以下是我的代码:

packages = c('tmap', 'sf', 'tidyverse', 'RColorBrewer', 'classInt', 
'raster', 'sp', 'REAT', 'SpatialAcc', 'shiny', 'leaflet', 'factoextra',  
'NbClust')

for(p in packages){
  if(!require(p, character.only = T)){
    install.packages(p)
  }
  library(p, character.only = T)
}

What could be the problem?. 可能是什么问题呢?。

I tried deploying through the following command in rstudio. 我尝试通过rstudio中的以下命令进行部署。

library(rsconnect)
rsconnect::deployApp('D:/student/mypath')

The issue is that shinyapps.io doesn't let you install R packages on their server. 问题是shinyapps.io不允许您在R软件包的服务器上安装R软件包。 Allowing that would not really make sense for security reasons so please don't try to "hack" your way into an installation. 出于安全原因,允许这样做实际上没有任何意义,因此请不要尝试“破解”安装方式。

Instead file an issue (or a PR) on the github repo shinyapps dependencies and ask them to support your missing packages. 而是在github repo Shinyapps依赖项上提交一个问题(或PR),并要求他们支持您丢失的软件包。

A second solution is to purchase a server and set up shiny-server yourself. 第二种解决方案是购买服务器并自行设置闪亮服务器。 Then you will be free to install packages at will. 这样您就可以随意安装软件包。 Instructions about that can be found here . 有关说明,请参见此处


Edit : Actually, it seems custom libraries are supported on shinyapps.io and they will be installed automatically based on your library and require calls. 编辑 :实际上, shinyapps.io似乎支持自定义库,它们将根据您的library自动安装并require调用。 So you probably just need to remove the ìnstall.packages part in your uploaded app. 因此,您可能只需要删除上载应用程序中的“ ìnstall.packages部分。

When you deploy your application, the rsconnect package attempts to detect the packages that your application uses. 部署应用程序时,rsconnect软件包将尝试检测您的应用程序使用的软件包。 rsconnect sends this list of packages and their dependencies along with your application to the shinyapps.io service. rsconnect将此软件包及其依赖项列表与您的应用程序一起发送到Shinyapps.io服务。 Then shinyapps.io builds and installs the packages into the R library for your application. 然后,shinyapps.io会为您的应用程序将软件包构建并安装到R库中。 The first time you deploy your application, it may take some time to build these packages (depending on how many packages are used). 首次部署应用程序时,可能需要一些时间来构建这些软件包(取决于使用了多少个软件包)。 However, you will not wait for these packages to build during future deployments (unless you upgrade or downgrade a package) 但是,您不会等待这些软件包在以后的部署期间生成(除非您升级或降级了软件包)

-- Shinyapps.io - Getting started -Shinyapps.io-入门

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM