【问题标题】:Shiny app fails at reading packages: The application failed to start (exited with code 1)Shiny 应用程序读取包失败:应用程序无法启动(退出代码 1)
【发布时间】:2020-03-07 13:13:04
【问题描述】:

我可以在本地部署我的 Shiny 应用程序,但是当我尝试在 shinyapps.io 中部署它时,应用程序无法启动

我已经检查了很多问题和类似问题,但没有一个答案对我有用。我的代码中没有包含 install.packages() 或 setwd() 行。

我的闪亮应用使用以下库:

library(shiny)
library(RColorBrewer)
library(data.table)
library(sf)
library(ggmap)
library(osmdata)
library(rsconnect)
library(tidyverse)

当我尝试部署它时,我在闪亮的应用程序 url 中收到此错误消息:

An error has occurred
The application failed to start (exited with code 1).

Error in value[[3L]](cond) : there is no package called ‘RColorBrewer’
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

而 RStudio IDE 中的这个错误:

Preparing to deploy application...DONE
Uploading bundle for application: 1454528...DONE
Deploying bundle: 2581070 for application: 1454528 ...
Waiting for task: 666404305
  building: Processing bundle: 2581070
  building: Installing packages
  building: Installing files
  building: Pushing image: 2799820
  deploying: Starting instances
  terminating: Stopping old instances
Application successfully deployed to https://racofernandez.shinyapps.io/superficie-deptos-caba/
Deployment completed: https://racofernandez.shinyapps.io/superficie-deptos-caba/
Warning message:
In fileDependencies.R(file) :
  Failed to parse C:/Users/rama_/AppData/Local/Temp/Rtmp63cnOU/file3b2c779a2a37/app.R ; dependencies in this file will not be discovered.

有什么建议吗?谢谢!

【问题讨论】:

  • there is no package called ‘RColorBrewer’ :看起来很简单,不是吗?你需要安装它
  • 嗨!我已经在本地安装了所有的包,我可以在本地运行应用程序,我认为在服务器中部署应用程序时,shinyapps.io 如何检测应用程序用于安装它们的包是一个问题。

标签: r shiny shinyapps


【解决方案1】:

问题是由我的脚本中包含的特殊字符(如“ñ”)产生的,如以下问题所示:Error in Shiny deployment on shinyapps.io

【讨论】:

  • 太棒了!我很沮丧。我的问题是我在 expression() 函数中使用了重音符号。我所做的是用接收字符串的latex2exp::TeX() 函数替换它。另外,我在输出和输入中使用了内部变量,例如output$gráfica,它通过替换output$graficaoutput$`gráfica`来工作
【解决方案2】:

欢迎!

您的错误日志打印:

解析 C:/Users/rama_/AppData/Local/Temp/Rtmp63cnOU/file3b2c779a2a37/app.R 失败;不会发现此文件中的依赖项。

shinyapps.io 通过解析 R 文件来检测依赖关系,并检测所需的包。

这里,shinyapps 无法解析app.R 文件,因此无法检测需要哪些包。

您可能想在本地尝试packrat::init() 以检测错误。

【讨论】:

  • 这帮助我意识到问题是因为我的脚本中有特殊字符“ñ”。谢谢!!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-11
  • 1970-01-01
  • 2022-01-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多