0

I have a shinnyapp on https://www.shinyapps.io/ that I can normally deploy the app using the "publish" button.

However I want to use instead the deployApp function as in the code bellow:

rsconnect::deployApp("~/Documents/R/shinny",appName="myapp", account="myaccount")

But when using the deployApp function it gets an error on the web browser:

An error has occurred

The application failed to start: exited unexpectedly with code 1

Attaching package: ‘dplyr’

The following objects are masked from ‘package:plyr’:

    arrange, count, desc, failwith, id, mutate, rename, summarise,
    summarize

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

Error in value[[3L]](cond) : could not find function "dashboardPage"
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

So If push the button, no problem but if I use the function it goes wrong.

My Rscript structure is bellow ( there are more code inside the functions but I keep it simple to exemplify)

library(shinydashboard)
library(shiny)
library(ggplot2)
library(dplyr)
library(scales)
library(lubridate)
library(zoo)
library(reshape2)
library(scales)
library(ggrepel)
library(stringr)
load("sales.RData")

sidebar <- dashboardSidebar(
                              
                            )
)

body <- dashboardBody(
)

ui <- fluidPage(dashboardPage(
  dashboardHeader(),
  sidebar,
  body
)
)


server <- function(input, output) {
  
}

# Run the application 
shinyApp(ui = ui, server = server)

rsconnect::deployApp('C:\\Users\\Repro\\Documents\\R\\SHINY', 
                     appFiles = c('app.R','sales.RData','www/custom.css'), 
                     account = 'myaccount', server = 'shinyapps.io')

What could be the problem ?

Thanks

6
  • Is library(shiny) or rather library(shinydashboard) at the head of your script ?
    – Guillaume
    Apr 11, 2021 at 11:27
  • Hello. Both are included. Apr 11, 2021 at 23:37
  • Is your app build in a Rproject with all scripts inside it? (maybe an hypothesis, cause we don't have your scripts so it's no easy).
    – Guillaume
    Apr 12, 2021 at 9:19
  • Hello. I have updated the question with my app structure. Hope it can clarify. Apr 12, 2021 at 18:48
  • Hello. When I deployApp, I don't put path in parameters, I build my application as an Rproject with RStudio and then just run rsconnect::deployApp() directly without any parameters. Can you try this?
    – Guillaume
    Apr 13, 2021 at 8:50

1 Answer 1

1

After trial and error I solved the problem.

My mistake was trying to execute the app.R script including the deploy script altogether.

When I run the deploy script separately as bellow, it works:

    rsconnect::setAccountInfo(name='myaccount',
                          token='xxxxxxxxx',
                          secret='yyyyyyyy')

rsconnect::deployApp(appDir = 'C:\\Users\\Documents\\R\\SHINY',appFiles=c('app.R','sales.RData','www/custom.css'),
account = 'myaccount', server = 'shinyapps.io')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.