Introduction
The {shinylive}
package enables you to run Shiny applications entirely in the browser by converting them into static files powered by WebAssembly. In this tutorial, we’ll walk through the installation process and explain how to configure asset management so that your Shiny apps can run serverlessly.
1. Installing the {shinylive}
Package
You have two main options for installing {shinylive}
:
Option 1: Install from CRAN
Run the following command in R:
install.packages("shinylive")
This installs the latest stable release from CRAN.
Option 2: Install the Development Version from GitHub
For the latest features and updates, use the pak
package:
# If pak is not installed, install it first
install.packages("pak")
::pak("posit-dev/r-shinylive") pak
Choose the option that best fits your needs.
2. Configuring Asset Management
The {shinylive}
package downloads essential web assets (HTML, JavaScript, CSS, WASM files) required to run Shiny apps in the browser. These assets are cached locally for faster loading.
Check Installed Asset Information
After installation, verify that assets are installed and see version details:
::assets_info() shinylive
This function displays the package version, asset version, and the local cache directory.
Here is an example output:
shinylive R package version: 0.3.0.9000
shinylive web assets version: 0.9.1
Local cached shinylive asset dir:
→ /root/.cache/shinylive
Installed assets:
• /root/.cache/shinylive/shinylive-0.9.1
Manually Download Specific Assets (Optional)
If you need to force a download of a specific asset version, run:
::assets_download("0.1.5") shinylive
Replace "0.1.5"
with your desired version.
Clean Up Old Assets
To remove outdated assets and free up space, use:
::assets_cleanup() shinylive
Or to remove a specific version:
::assets_remove("0.1.5") shinylive
3. Confirming Your Setup
Once installed, confirm that everything is working properly by running:
::assets_info() shinylive
This should print the current version details and the cache path where the assets are stored. If everything is set up correctly, you’re ready to export and run your Shiny apps using {shinylive}
.
Further Reading
- Introduction to Shinylive for R
Get an overview of Shinylive, its components, and its benefits. - Installing and Setting Up Shinylive (R)
Learn how to install the {shinylive} package and configure asset management. - Creating a Basic Shinylive Application (R)
Build and export your first Shinylive app. - Embedding Shinylive Apps in Quarto Documents (R)
Learn how to integrate Shinylive apps directly into your Quarto documents.
Conclusion
Installing and setting up {shinylive}
in R is the first step toward creating serverless Shiny applications that run directly in your web browser. By following this guide, you’ve learned how to install the package, configure asset management, and verify your installation. With these tools in place, you’re ready to convert and deploy Shiny apps for interactive, static web pages.
Explore More Articles
Here are more articles from the same category to help you dive deeper into the topic.
Reuse
Citation
@online{kassambara2025,
author = {Kassambara, Alboukadel},
title = {Installing and {Setting} {Up} {Shinylive} {(R)}},
date = {2025-03-17},
url = {https://www.datanovia.com/learn/interactive/r/shinylive/installation.html},
langid = {en}
}