Advanced Customization and Troubleshooting for Shinylive (R)

Asset Management, Multi-App Handling, and Common Issue Resolution

Explore advanced topics in Shinylive for R. Learn how to manage assets, handle multiple Shiny apps in one deployment, and troubleshoot common issues with serverless Shiny applications.

Tools
Author
Affiliation
Published

March 17, 2025

Keywords

advanced Shinylive R, Shinylive troubleshooting, customization shinylive

Introduction

Shinylive enables you to run Shiny applications entirely in the browser using WebAssembly. In this advanced tutorial, we explore techniques to fine-tune your Shinylive deployment by managing assets, handling multiple applications, and troubleshooting common issues. These advanced methods will help you create robust, serverless Shiny apps that are easy to maintain and deploy.



1. Asset Management

Efficient asset management ensures your Shinylive app runs smoothly. The {shinylive} package handles web assets (HTML, JavaScript, CSS, and WASM files) required for serverless Shiny.

Checking Asset Information

Use the following command to check installed asset versions and cache paths:

shinylive::assets_info()

This command returns details such as the Shinylive R package version, the asset version, and the local cache directory.

Downloading and Updating Assets

To manually download a specific version of the assets (if needed), run:

shinylive::assets_download("0.1.5")

Replace "0.1.5" with the desired version.

Cleaning Up Old Assets

Over time, your cache may accumulate outdated assets. Clean them up using:

shinylive::assets_cleanup()

Or remove a specific version:

shinylive::assets_remove("0.1.5")
Tip

Regularly cleaning up assets can help avoid conflicts and save disk space.

2. Handling Multiple Applications

If you have several Shiny applications, you can export them into subdirectories so they share the same Shinylive assets. This is useful for creating a centralized static site for multiple apps.

Example: Exporting Multiple Apps

Assume you have two Shiny apps located in myapp1 and myapp2. You can export them as follows:

shinylive::export("myapp1", "site", subdir = "app1")
shinylive::export("myapp2", "site", subdir = "app2")

This command creates separate folders (e.g., site/app1 and site/app2) within your exported site, sharing the common Shinylive assets.

Tip

Organizing multiple apps in subdirectories simplifies maintenance and allows you to manage shared assets efficiently.

3. Troubleshooting Common Issues

Even with a robust setup, you may encounter issues when deploying Shinylive apps. Here are some common troubleshooting steps:

Missing or Outdated Assets

  • Symptom: Your app fails to load or displays errors related to missing JavaScript or WASM files.
  • Solution:
    • Run shinylive::assets_info() to verify installed versions.
    • If assets are missing or outdated, use shinylive::assets_download() to update them.

Export Problems

  • Symptom: The export process fails or the output directory does not contain expected files.
  • Solution:
    • Ensure that your Shiny app is functioning locally before exporting.
    • Double-check that the directory paths in your export command are correct.
    • Perform a clean rebuild using quarto clean if integrated with Quarto.

Deployment Issues

  • Symptom: The exported app works locally but fails when deployed to a static hosting service.
  • Solution:
    • Verify that your hosting service is correctly configured to serve static files.
    • Ensure that all asset paths are relative and that the directory structure is maintained during deployment.

General Debugging

  • Monitor Console Logs:
    Open your browser’s developer console to check for error messages.
  • Test Incrementally:
    Export and test your app in small parts to isolate where issues occur.
  • Consult Documentation:
    Refer to the official Shinylive documentation and community forums for additional help.

Further Reading

Conclusion

Advanced customization and troubleshooting are essential for maintaining robust Shinylive applications. By managing assets carefully, organizing multiple apps effectively, and following best practices, you can ensure your serverless Shiny apps perform reliably on static hosting services. Use the troubleshooting tips to resolve issues quickly and refer to the further reading resources for deeper insights into advanced configurations.

Back to top

Reuse

Citation

BibTeX citation:
@online{kassambara2025,
  author = {Kassambara, Alboukadel},
  title = {Advanced {Customization} and {Troubleshooting} for
    {Shinylive} {(R)}},
  date = {2025-03-17},
  url = {https://www.datanovia.com/learn/interactive/r/shinylive/advanced.html},
  langid = {en}
}
For attribution, please cite this work as:
Kassambara, Alboukadel. 2025. “Advanced Customization and Troubleshooting for Shinylive (R).” March 17, 2025. https://www.datanovia.com/learn/interactive/r/shinylive/advanced.html.

Enjoyed this page?

We'd appreciate it if you could share it with your friends or colleagues. Spread the knowledge!

Stay connected with us to never miss out on future posts by following us: