Site icon R-bloggers

Deploying a Golem Shiny App to ShinyApps.io

[This article was first published on https://pacha.dev/blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
< !DOCTYPE html> < charset="utf-8"> < http-equiv="X-UA-Compatible" content="IE=edge"> < name="viewport" content="width=device-width, initial-scale=1.0"> pacha.dev/blog < !-- MathJax Configuration --> < !-- Smart header: libraries detected based on content --> < !-- File: /tmp/tmp.2lkz4u3IFr/index.html -->
  • < !-- DEBUG: Found sourceCode --> < !-- Load custom CSS after any library CSS to ensure proper precedence -->
  • < header class="site-top">

    Mauricio “Pachá” Vargas Sepúlveda

    Blog with notes about R, Shiny, SQL, Python, Linux and C++. This blog is listed on R-Bloggers.

    HOME 🏠
    < !-- categories are printed below this--> < nav class="sidebar-nav">

    Categories

    < header id="title-block-header" class="quarto-title-block default">

    Deploying a Golem Shiny App to ShinyApps.io

    How I had to troubleshoot some issues.
    Author

    Mauricio “Pachá” Vargas S.

    Published

    August 24, 2025

    Because of delays with my scholarship payment, if this post is useful to you I kindly ask a minimal donation on Buy Me a Coffee. It shall be used to continue my Open Source efforts. The full explanation is here: A Personal Message from an Open Source Contributor. If you play the electric guitar, the same scholarship chaos led me to turn my guitar pedals and DIY kits hobby into a business, and you can check those here.

    I uploaded a Shiny app made with Golem to Shiny Apps for a live demo. I had to troubleshoot a few issues with the deployment so here are the steps I used. I hope this is useful 🙂

    After creating a Shiny app skeleton with golem::create_golem("pkgname") you can create an app such as the 2×2 Cobb-Douglas General Equilibrium viewer (code on GitHub).

    When I tried to deploy that Cobb-Douglas app to ShinyApps.io I got this message:

    > rsconnect::deployApp()
    ℹ Capturing R dependencies
    The following package(s) were installed from an unknown source:
    - cobbdouglasge [0.0.0.9000]
    renv may be unable to restore these packages in the future.
    Consider reinstalling these packages from a known source (e.g. CRAN).
    
    Error in renv_snapshot_validate_report(valid, prompt, force) : 
      aborting snapshot due to pre-flight validation failure

    The cause of the problem is that when testing my app, I installed it locally with devtools::install(), and ShinyApps needs CRAN or GitHub as a source for the dependencies.

    To remedy that, I added the following to dev/03_deploy.R without running it:

    golem::add_shinyappsio_file()
    remotes::install_github("pachadotdev/cobbdouglasge")
    use_git_ignore("rsconnect/")
    rsconnect::deployApp()

    I know pak is the standard these days, but it gave me a compilation error when I tried to install it, so I used remotes.

    As an optional step to save space in my ShinyApps account, I created the file .rscignore containing:

    .here
    CODE_OF_CONDUCT.md
    LICENSE*
    NEWS*
    README*
    dev
    man
    vignettes
    tests

    Then I ran the previous chunk that allowed me to deploy the Cobb-Douglas app without errors.

    < footer>

    Loading…

  • < !-- Load shared sidebar -->
    To leave a comment for the author, please follow the link and comment on their blog: https://pacha.dev/blog.

    R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
    Exit mobile version