Shiny App Failed to Start

HI everyone,

I am trying to deploy my Shiny app using and having trouble deploying it to the server using rsconnect::deployApp. I get the following error message:

" An error has occurred

The application failed to start. Contact the author for more information."

I have found some documentation that indicates it may have to do with where we are pulling the data from (r - Getting an error when trying to publish my shiny app to the server for others to view - Stack Overflow) but we have another application that uses the same strategy and works fine (sets the working directory to the location of the app.R file and pulls data from the /data folder).

Can someone please provide any insight (happy to share code or other information if helpful)?

Best, Sean

Hi, welcome!

We don't have enough information to help you out, Could you check what your app's logs say?

Hi yes, I was just looking at this (please see below). It seems like it doesn't like a couple of my packages?

2022-05-23T16:17:45.365412+00:00 shinyapps[6224863]: Running on host: 0080208b919d
2022-05-23T16:17:45.365498+00:00 shinyapps[6224863]: LANG: C.UTF-8
2022-05-23T16:17:45.365635+00:00 shinyapps[6224863]: R version: 4.1.1
2022-05-23T16:17:45.365696+00:00 shinyapps[6224863]: shiny version: 1.6.0
2022-05-23T16:17:45.365434+00:00 shinyapps[6224863]: Server version: 2022.03.1
2022-05-23T16:17:45.365573+00:00 shinyapps[6224863]: Working directory: /srv/connect/apps/sample_tracking
2022-05-23T16:17:45.365876+00:00 shinyapps[6224863]: knitr version: 1.34
2022-05-23T16:17:45.365756+00:00 shinyapps[6224863]: httpuv version: 1.6.3
2022-05-23T16:17:45.365817+00:00 shinyapps[6224863]: rmarkdown version: 2.11
2022-05-23T16:17:45.365927+00:00 shinyapps[6224863]: jsonlite version: 1.7.2
2022-05-23T16:17:45.365982+00:00 shinyapps[6224863]: RJSONIO version: (none)
2022-05-23T16:17:45.366092+00:00 shinyapps[6224863]: reticulate version: (none)
2022-05-23T16:17:45.366278+00:00 shinyapps[6224863]:
2022-05-23T16:17:45.366213+00:00 shinyapps[6224863]: Using jsonlite for JSON processing
2022-05-23T16:17:45.366353+00:00 shinyapps[6224863]: Starting R with process ID: '26'
2022-05-23T16:17:45.366401+00:00 shinyapps[6224863]: Shiny application starting ...
2022-05-23T16:17:45.366036+00:00 shinyapps[6224863]: htmltools version: 0.5.2
2022-05-23T16:17:45.366639+00:00 shinyapps[6224863]: The following object is masked from ‘package:shiny’:
2022-05-23T16:17:45.366704+00:00 shinyapps[6224863]:
2022-05-23T16:17:45.366151+00:00 shinyapps[6224863]: Using pandoc: /opt/connect/ext/pandoc/2.16
2022-05-23T16:17:45.366757+00:00 shinyapps[6224863]: span
2022-05-23T16:17:45.366582+00:00 shinyapps[6224863]:
2022-05-23T16:17:45.366814+00:00 shinyapps[6224863]:
2022-05-23T16:17:45.366936+00:00 shinyapps[6224863]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2022-05-23T16:17:45.366871+00:00 shinyapps[6224863]: Loading required package: plyr
2022-05-23T16:17:45.366995+00:00 shinyapps[6224863]: there is no package called ‘plyr’
2022-05-23T16:17:45.366523+00:00 shinyapps[6224863]: Attaching package: ‘ggplot2bdc’
2022-05-23T16:17:45.367123+00:00 shinyapps[6224863]: 'lib = "/opt/R/4.1.1/lib/R/library"' is not writable
2022-05-23T16:17:45.366460+00:00 shinyapps[6224863]:
2022-05-23T16:17:45.367058+00:00 shinyapps[6224863]: Warning in install.packages(x, dependencies = TRUE) :
2022-05-23T16:17:45.367301+00:00 shinyapps[6224863]: Shiny application exiting ...
2022-05-23T16:17:45.367239+00:00 shinyapps[6224863]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
2022-05-23T16:17:45.367356+00:00 shinyapps[6224863]: Execution halted
2022-05-23T16:17:45.367186+00:00 shinyapps[6224863]: Error in value[3L] : unable to install packages

Are you including install commands in your code? Can you show the code of your app?

Yes of course, here is the code for the packages:

## First specify the packages of interest
packages = c("plyr",
             "shinythemes" ,

## Now load or install&load all
package.check <- lapply( packages, FUN = function(x) {
  if (!require(x, character.only = TRUE)) {
    install.packages(x, dependencies = TRUE)
    library(x, character.only = TRUE)

That is exactly the problem, you should not include install commands on a shiny app, specially if it is going to be deployed to

Great, thank you so much for your help!!

A post was split to a new topic: Error starting app, package not found