Shiny can run in local but fail to publish to shinyapps.io

I developped shiny app and it works fine locally. However I got this error when trying to publish to shinyapps.io

Error: Unhandled Exception: Child Task 1216981299 failed: Application mode static not supported.
Execution halted

  1. Do we need to publish library folder as well?
  2. How can I solve this error? My code is posted below.
packages = c('shiny', 'shinythemes', 'wordcloud','dplyr', 'igraph', 'networkD3','visNetwork')

for(p in packages){
  library(p, character.only = T)
}

list <- c("focusgroup" = 1,
          "influencer" = 2
          )
All <- readRDS(file = "All.rds")
All_data <- readRDS(file = "All_data.rds")

data(MisLinks)
data(MisNodes)

#======================= User Interface ======================================#

ui <- fluidPage(theme = shinytheme("darkly"),
             
                titlePanel("Cryptoverse"),
                
                sidebarLayout(
                  sidebarPanel(
                    
                    sliderInput("slider", "Slider",min = Sys.Date() - 365*2, max = Sys.Date(), value =  c(Sys.Date() - 30, Sys.Date()) ),
                    dateRangeInput("daterange", "Input date range", start = Sys.Date() - 30,end = Sys.Date() ),
                    selectInput("selection", "Select group", choices = list, selected = 1),dataTableOutput("table")
                  ),
                  
                  mainPanel(
                    
                    forceNetworkOutput("force"),
                    plotOutput("plot")
                    
                  )
                )
        )
#================================ Server ====================================#

server <- function(input, output, session) {
  # Avoid chain reaction
  reactdelay <- 1
  change_slider <- reactiveVal(Sys.time())
  change_daterange <- reactiveVal(Sys.time())

  observeEvent(input$slider, {
    if (difftime(Sys.time(), change_slider()) > reactdelay) {
      change_daterange(Sys.time())
      updateDateRangeInput(session,
                           "daterange",
                           start = input$slider[[1]],
                           end = input$slider[[2]])
    }
  })

  observeEvent(input$daterange, {
    if (difftime(Sys.time(), change_daterange()) > reactdelay) {
      change_slider(Sys.time())
      updateSliderInput(session,
                        "slider",
                        value = c(input$daterange[[1]], input$daterange[[2]]))
    }
  })

  filtered <- reactive({
    All %>%
      filter(id == input$selection,
             created_at >= as.Date(input$daterange[[1]]),
             created_at <= as.Date(input$daterange[[2]])
      )
  })

  output$plot <- renderPlot({
    wordcloud(filtered()$text, min.freq=50, scale=c(3.5, 0.5), random.order=FALSE, rot.per=0.35, colors=brewer.pal(8, "Dark2"))
  })

  filtered2 <- reactive({
    All_data %>%
      filter(id == input$selection,
             created_at >= as.Date(input$daterange[[1]]),
             created_at <= as.Date(input$daterange[[2]])
      )
  })

  output$table <- renderDataTable({
    table <- filtered2()
    table
  })
  
  output$force <- renderForceNetwork({
    forceNetwork(Links = MisLinks, Nodes = MisNodes,
                 Source = "source", Target = "target",
                 Value = "value", NodeID = "name",
                 Group = "group", opacity = input$opacity)
  })
}
#================================ Engine ====================================#

shinyApp(ui, server)

I've solved this problem by changing the method of calling library as follow.

library(shiny)
library(shinythemes)
library(wordcloud)
library(dplyr)
library(igraph)
library(networkD3)
library(visNetwork)

Hi,

I'm having a similar error after trying to deploy an app that I already had working. This is the error message I get:

> deployApp()
Preparing to deploy application...
Update application currently deployed at
https://gabrielascui.shinyapps.io/qupath_to_fcs/? [Y/n] Y
DONE
Uploading bundle for application: 771081...DONE
Deploying bundle: 6588414 for application: 771081 ...
Waiting for task: 1253457660
  building: Parsing manifest
################################ Begin Task Log ################################ 
################################# End Task Log ################################# 
Error: Unhandled Exception: Child Task 1253457661 failed: Application mode static not supported.
In addition: Warning messages:
1: invalid uid value replaced by that for user 'nobody' 
2: invalid gid value replaced by that for user 'nobody' 

Nothing new has been added to the app. This is my sessionInfo :

R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS  11.5.2

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rsconnect_0.8.28    DT_0.26             data.table_1.14.6   Biobase_2.50.0      BiocGenerics_0.36.1 flowCore_2.0.1      ggplot2_3.4.0       shiny_1.7.3        

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9          RProtoBufLib_2.0.0  assertthat_0.2.1    digest_0.6.30       utf8_1.2.2          mime_0.12           R6_2.5.1            stats4_4.0.3        evaluate_0.18       pillar_1.8.1       
[11] rlang_1.0.6         curl_4.3.3          rstudioapi_0.14     fontawesome_0.4.0   jquerylib_0.1.4     rmarkdown_2.18      textshaping_0.3.6   labeling_0.4.2      htmlwidgets_1.5.4   munsell_0.5.0      
[21] compiler_4.0.3      httpuv_1.6.6        xfun_0.35           pkgconfig_2.0.3     askpass_1.1         systemfonts_1.0.4   htmltools_0.5.3     sourcetools_0.1.7   openssl_2.0.4       tidyselect_1.2.0   
[31] tibble_3.1.8        matrixStats_0.63.0  fansi_1.0.3         crayon_1.5.2        dplyr_1.0.10        withr_2.5.0         later_1.3.0         grid_4.0.3          jsonlite_1.8.3      xtable_1.8-4       
[41] gtable_0.3.1        lifecycle_1.0.3     DBI_1.1.3           magrittr_2.0.3      scales_1.2.1        RcppParallel_5.1.5  cli_3.4.1           cachem_1.0.6        farver_2.1.1        promises_1.2.0.1   
[51] bslib_0.4.1         ellipsis_0.3.2      ragg_1.2.4          generics_0.1.3      vctrs_0.5.1         tools_4.0.3         glue_1.6.2          crosstalk_1.2.0     fastmap_1.1.0       yaml_2.3.6         
[61] colorspace_2.0-3    BiocManager_1.30.19 cytolib_2.0.3       memoise_2.0.1       knitr_1.41          sass_0.4.4 

Any help is appreciated!