2

I can deploy my Shiny app locally, but when I try to deploy it in shinyapps.io, the application fails to start

I've already checked a lot of issues and similar questions but none of the answers worked for me. I don't include install.packages() or setwd() lines in my code.

My shiny app uses the following libraries:

library(shiny)
library(RColorBrewer)
library(data.table)
library(sf)
library(ggmap)
library(osmdata)
library(rsconnect)
library(tidyverse)

And I get this error message in the shiny apps url when I try to deploy it:

An error has occurred
The application failed to start (exited with code 1).

Error in value[[3L]](cond) : there is no package called ‘RColorBrewer’
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

And this error in the RStudio IDE:

Preparing to deploy application...DONE
Uploading bundle for application: 1454528...DONE
Deploying bundle: 2581070 for application: 1454528 ...
Waiting for task: 666404305
  building: Processing bundle: 2581070
  building: Installing packages
  building: Installing files
  building: Pushing image: 2799820
  deploying: Starting instances
  terminating: Stopping old instances
Application successfully deployed to https://racofernandez.shinyapps.io/superficie-deptos-caba/
Deployment completed: https://racofernandez.shinyapps.io/superficie-deptos-caba/
Warning message:
In fileDependencies.R(file) :
  Failed to parse C:/Users/rama_/AppData/Local/Temp/Rtmp63cnOU/file3b2c779a2a37/app.R ; dependencies in this file will not be discovered.

Any suggestions? Thanks!

  • 1
    `there is no package called ‘RColorBrewer’` : looks straightforward no ? You need to install it – Chapo Nov 11 '19 at 23:33
  • Hi! I have installed all the packages locally and I can run the app locally, I think it's a problem about how shinyapps.io detects the packages that the app uses to install them when deploying the app in the server. – racofernandez Nov 12 '19 at 14:07

2 Answers2

2

The issue was generated by special characters like "ñ" included in my script, as showed in this question: Error in Shiny deployment on shinyapps.io

  • Awesome! I was so frustrated. My issue was that I was using an accent in the `expression()` function. What I did was replacing this with the `latex2exp::TeX()` function which recieved a string. Also, I was using inside variables In the output and input such as `output$gráfica` and it worked by replacing `output$grafica` or `output$\`gráfica\`` – Edgar Alarcón Jan 01 '21 at 17:33
1

Welcome on SO!

Your error log prints:

Failed to parse C:/Users/rama_/AppData/Local/Temp/Rtmp63cnOU/file3b2c779a2a37/app.R ; dependencies in this file will not be discovered.

shinyapps.io detects dependencies by parsing the R files, and detects the packages needed.

Here, shinyapps could not parse the app.R file, so couldn't detect which packages are needed.

You might want to try packrat::init() locally to detect the error.

Colin FAY
  • 4,849
  • 1
  • 12
  • 29