Problem with publishing to missing package shinydashbaord

After I deploy (publish) my app using R Studio in which the app runs, log of my app shows a problem with the package 'shinydashboard'. This is the error:
Loading required package: shinydashboard
2024-06-04T10:17:17.326251+00:00 shinyapps[12122926]: Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
2024-06-04T10:17:17.330125+00:00 shinyapps[12122926]: there is no package called ‘shinydashboard’
2024-06-04T10:17:17.334152+00:00 shinyapps[12122926]: Installing package into ‘/usr/lib/R’
2024-06-04T10:17:17.340180+00:00 shinyapps[12122926]: (as ‘lib’ is unspecified)
2024-06-04T10:17:17.344000+00:00 shinyapps[12122926]: Warning: Error in contrib.url: trying to use CRAN without setting a mirror
2024-06-04T10:17:17.347523+00:00 shinyapps[12122926]: 83: stop
2024-06-04T10:17:17.351242+00:00 shinyapps[12122926]: 82: contrib.url
2024-06-04T10:17:17.354762+00:00 shinyapps[12122926]: 80: install.packages
2024-06-04T10:17:17.358261+00:00 shinyapps[12122926]: 79: eval
2024-06-04T10:17:17.361803+00:00 shinyapps[12122926]: 78: eval
2024-06-04T10:17:17.365620+00:00 shinyapps[12122926]: 76: source
2024-06-04T10:17:17.369137+00:00 shinyapps[12122926]: 15:
2024-06-04T10:17:17.372920+00:00 shinyapps[12122926]: 13: fn
2024-06-04T10:17:17.377216+00:00 shinyapps[12122926]: 8: retry
2024-06-04T10:17:17.380945+00:00 shinyapps[12122926]: 7: connect$retryingStartServer
2024-06-04T10:17:17.384510+00:00 shinyapps[12122926]: 6: eval
2024-06-04T10:17:17.388265+00:00 shinyapps[12122926]: 5: eval
2024-06-04T10:17:17.392036+00:00 shinyapps[12122926]: 4: eval
2024-06-04T10:17:17.395884+00:00 shinyapps[12122926]: 3: eval
2024-06-04T10:17:17.399535+00:00 shinyapps[12122926]: 2: eval.parent
2024-06-04T10:17:17.402821+00:00 shinyapps[12122926]: 1: local
2024-06-04T10:29:36.297163+00:00 shinyapps[12122926]: Container event from container-9659542: stop

Now the package is installed in R Studio. Running the app locally does not produce this error.
I have a separate script (loadlibs.R) that checks for and installs if needed any packages, including shinydashboard.

Anyone any idea why it runs locally, but when published runs into this issue?


Does the app explicitly load shinydashboard (either library(shinydashboard) or require(shinydashboard) or shinydashboard::<some function> somewhere in the code)? I believe that the program (rsconnect?) that deploys an app from your local RStudio to first scans the app to see what packages are needed and then tells the server to build an instance containing those packages (and only those packages). I've encountered at least one adventure where a package was being used "implicitly" and did not get included. Sticking a library() call to make it obvious the package was in use solved the problem.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.