Error in shiny app deployment


I am new to shiny and trying to publish my first app on
Once I publish the app and launch it I get this error:

Error in value[3L] : there is no package called ‘ggplot2’
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted

I past almost 2 days surfing the internet and I think I tried all suggested solutions. I did my app in 2 files (app.R and global.R) and then in 3 files (server.R, ui.R and global.R).
I am not sure why the packages are not recognize when I publish it.
In my global.R file I have all the libraries that I need and that is also where I called my dataset and process all the necessary cleaning steps:


df = read.csv('countries-aggregated.csv',
header = TRUE, na.strings=c("","NA"), sep = ",")

df$Actif = df$Confirmed - df$Recovered - df$Deaths

cases = aggregate(list(cases=df$Confirmed), by=list(Date=as.Date(df$Date)), FUN=sum)

deaths = aggregate(list(deaths=df$Deaths), by=list(Date=as.Date(df$Date)), FUN=sum)

recovered = aggregate(list(recovered=df$Recovered), by=list(Date=as.Date(df$Date)), FUN=sum, na.rm=TRUE)

cases$NewCases <- ave(cases$cases, FUN=function(x) c(0, diff(x)))
deaths$NewDeaths <- ave(deaths$deaths, FUN=function(x) c(0, diff(x)))
recovered$NewRec <- ave(recovered$recovered, FUN=function(x) c(0, diff(x)))

newdf = cbind(Date=as.Date(cases$Date), cases[2:3], deaths[2:3], recovered[2:3])

newdf$Actif = newdf$cases - newdf$deaths - newdf$recovered

dfz = = as.Date(newdf$Date), "Cas confirmés" = newdf$cases, Décès = newdf$deaths, Guéris = newdf$recovered, "Cas actif" = newdf$Actif))

dfz$Date = as.Date(newdf$Date)

Molten <- melt(dfz, id.vars = "Date")

dfz2 = = as.Date(newdf$Date), "Nouveau Cas" = newdf$NewCases, "Décès" = newdf$NewDeaths, "Guéris" = newdf$NewRec))

dfz2$Date = as.Date(newdf$Date)

Molten2 <- melt(dfz2, id.vars = "Date")

Any help would be appreciated. I don't know if it is related to the way I called my dataset or I have extra step to do to make shinyapps to recognize the library I am using


Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I create one? Using a reprex, complete with representative data will attract quicker and more answers. This question doesn't require one, though.

It take a bit of digging in the demo app page to find:

The demo application we will deploy requires the ggplot2 package and the shiny package. Ensure that any package required by your application is installed locally before you deploy your application.

And this makes sense because what happens is that the system on the user side generates the code and the remote system, renders it.

1 Like

Have you installed a development version of ggplot2? is going to try to replicate your local version and installing from GitHub is proner to failure.
Anyways, try reinstalling ggplot2 from CRAN in your local system and redeploy your app.


Hello all

Thank you very much for your replies.
I actually find the problem. I had an encoding problem due to some special words in my app.
I encode all my files to utf-8 and was able to deploy the app.

Thank you

1 Like

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