error in deploying

Hi all,

my shiny app is running locally, but when I'm trying to deploy it to shinyapps using rsconnect deployApp(), I'm getting an error message:

https://matanmazor.shinyapps.io/sdtprimer/

The application failed to start (exited with code 1).

Registered S3 methods overwritten by 'ggplot2': method from [.quosures rlang c.quosures rlang print.quosures rlang Error in value[[3L]](cond) : there is no package called ‘markdown’ Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execution halted

Any idea what this might be?

Thanks!
-Matan

@tanzor, I suspect that on your local machine you may have markdown loaded, by is not part of your shiny application. What you need to do is have something like this rm(list = ls()) in your global.R. Or close RStudio and try to run your app locally. If any libraries are missing, you will know.

Try check that the shiny app has all the libraries.

1 Like

Thanks! The application does work on my local machine, so I guess markdown is not installed on the shinyapps server? Is there a way to overcome this problem?

Best,
-Matan

Have you resolved this, or are you trying to make a change to a working Shiny app?

When I click the link now, here's what I see:

Thanks Mara,

This is just because I gave up on integrating the markdown bits in - I kept getting error messages on the published version and even when running locally the text looked funny and some of the equations got corrupted.
(I opened a new topic to ask more broadly about what I'm trying to do)

Thanks!
-Matan

@tanzor, markdowns do work on shinyapps.io. See my app -> https://kill3rbee.shinyapps.io/vFeedCard/ When you click on About, that is a markdown I am using. I suspect you do not have the library(rmarkdown). Run your app locally fresh with having down anything. I have package shinyapp without including library and failed on shinyapp.io

@tanzor,
Just because the library is installed on your local machine does not mean, it will be packaged. You must have the library as part of your code, be it in your global.R. Why do I say this?
Sometimes you may write a program to test a small concept. When you do that, the library is loaded in memory and available globally for any code you write.
So you copy new working code into your app, test it and runs fine. I have done this before. So everytime before I deploy my app, I make sure I clear everything or close RStudio, start it from scratch and run my app just to be sure.

That could be the cause. You will have to eliminate that low hanging fruit

Thanks!

We're making some progress, I'm able to include markdown text now, but the equations are not rendered for some reason. I have the following equation in my md file:

$$L(\theta|data)\propto\prod_{c,s,r}Prob_\theta(Conf_{c}|Stim_s,Resp_r)^{n_{data}(Conf|Stim_s,Resp_r)}$$

But this is what I see on my shiny app:
[L(\theta|data)\propto\prod_{c,s,r}Prob_\theta(Conf_{c}|Stim_s,Resp_r)^{n_{data}(Conf|Stim_s,Resp_r)}]

Similarly, \theta is rendered as [\theta].

Any idea what the problem might be?

Thanks!
-Matan

More progress! I used rmarkdown::render() and now the equations are rendered properly. The only annoying thing is the before the markdown section. Is there a way to remove it?

Thanks!
-Matan

@tanzor,
Try saving file as *.rmd not *.md

Thanks

Thanks, but this didn't help: I'm still getting "< !DOCTYPE html >" before the markdown session, and the whole part is indented as a result. Any ideas how to avoid this?

Thanks!
-Matan

It is easier if you show us your code. Make sure your *rmd starts with this:


---
title: "About"
output: html_document
---

Thanks!

Okay I think this code should reproduce the problem:

app.R:

library(shiny)
library(markdown)

ui <- fluidPage(
           includeMarkdown(rmarkdown::render("meta.rmd"))
)
server <- function(input, output) {}
shinyApp(ui, server)

meta.rmd:

---
title: "meta"
output: html_document
---

The output has this annoying < !DOCTYPE html > at the top left corner. I must use the rmarkdown::render function because otherwise the equations don't get rendered.

Thanks again! I really appreciate your help on this.
cheers,
-Matan

Change this to :slight_smile:

library(rmarkdown)

Do not use markdown library. Try that and see what happens. Just tested markdown and rmarkdown no difference. I prefer rmarkdown cause I had issues with markdown do not remember what:

library(shiny)
library(rmarkdown)

ui <- fluidPage(
  includeMarkdown(file.path("appvFeedCardType2/rmd","about.rmd"))
)
server <- function(input, output) {}
shinyApp(ui, server)

Change file,path to match yours

about.rmd

---
title: "About"
output: html_document
---

### CARD - The Correlated Vulnerability, Threat and Exploit Database

This Shiny App is for searching and visualizing CARD a fully aggregated, cross-linked and standardized Vulnerability Database based on CVE and other standards (CPE, CWE, WASC, CVSS). 

This works no errors.

Thanks

Thanks,

I'm not sure I understand. In your example you don't include rmarkdown::render, which I have to include in order for the equations to be rendered. Am I missing something?

Best,
-Matan

I believe if you use withMathJax(includeMarkdown(...)), your equations will be rendered using the above method.

Try that, it should work:

library(shiny)
library(rmarkdown)

ui <- fluidPage(
  withMathJax(includeMarkdown(file.path("appvFeedCardType2/rmd","about.rmd")))
)
server <- function(input, output) {}
shinyApp(ui, server)

Create about.rmd

---
title: "About"
output: html_document
---

### CARD - The Correlated Vulnerability, Threat and Exploit Database

$$Exploitability = 20 \times AccessVector \times AccessComplexity \times Authentication$$

$$f(Impact)=\begin{cases}
\displaystyle 1, & \text{if Impact = 0}. \\\\
\displaystyle 1.176, & \text{otherwise}.
\end{cases}$$

There is one with equations, try and see

Thanks both! it's working now! :slight_smile:

1 Like