3

My app works perfectly when I run it locally, but when I host it in shinyapps.io this error comes out:

An error has occurred

The application failed to start.

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

I have two more apps online with the same ui.R and server.R layouts and both work fine. Even if I avoid the code involving shinyjs, it shows the app in the browser but the same error appears in the app log with the package openxlsx. The other two almost-identical apps working perfect got me completely lost.

Community
  • 1
  • 1
Elianux
  • 33
  • 1
  • 5
  • There must be a place where you load shinyjs or there must be a dependency, just install shinyjs and load it in the app code – Dinesh.hmn Oct 27 '17 at 20:11
  • I have the library installed and the script loads it. This app works locally, the problem is when it's uploaded to shinyapps.io, it's like if the package it's not installed in the server. But again, I have two more apps with the same structure working. The same error appears with other libraries when I remove shinyjs. It's rare that this app does not work while the other two runs with no issues. Thanks for the answer. – Elianux Oct 27 '17 at 20:19
  • It seems like `shinyjs` is not installed on the `shinyapps.io` server. You can create a feature request for new packages [here](https://github.com/rstudio/shinyapps-package-dependencies/) – Gregor de Cillia Oct 28 '17 at 10:27
  • @GregordeCillia Aparently, yes. The thing I can't figure out is why the other two apps using *shinyjs* too have no troubles. I'll take a look at that link you passed. Thanks. – Elianux Oct 30 '17 at 20:07

3 Answers3

2

In my experience, the issue happens in RStudio projects with a DESCRIPTION file, when the offending package (e.g. shinyjs) is NOT included in the Imports section of the DESCRIPTION file.

Gorka
  • 3,555
  • 1
  • 31
  • 37
0

I know this answer is late but in case is useful, here it is:

1.- Open a terminal and run: sudo R

2.- I installed shinyjs: install.packages("shinyjs", dependencies=TRUE)

3.- Create shinyjs directory: mkdir /usr/local/lib/R/site-library/shinyjs

4.- cd /usr/local/lib/R/site-library/shinyjs

4.- copy the shinyjs folder from the active username home R directory:

cp /home/username/R/x86_64-pc-linux-gnu-library/3.5/shinyjs/* -r .

Go to your web browsers and it will open your app.

Note. Be sure to change username for correct value and remember to set the privileges.

Carlos Kassab
  • 21
  • 1
  • 6
  • 1
    The question is about a problem loading the package in an app hosted on `shinyapps.io`, not locally – divibisan Mar 25 '19 at 21:24
  • Well, I mean locally when I run my app from rstudio but when I try to run it using shiny server it was not working and following my steps above worked fine. I posted it here in case is useful for somebody. – Carlos Kassab Mar 25 '19 at 22:59
  • It certainly should not be advised to install packages in this manner, be it on a shiny server or locally. – JohnCoene Mar 26 '19 at 12:14
  • Yes, you are totally correct, and I misunderstood, I am sorry for my confusion. In my case, I do not know why shinyjs was not installed when doing install.packages from R, so I solved it in the way I mentioned. If you feel the best is to delete all of my answers, please do it. – Carlos Kassab Mar 26 '19 at 13:15
0

When you deploy your app on shinyapps.io the serve has to understand where the packages were installed from. The two most common sources of package installations probably are:

  • CRAN
  • Github

Looking at the documentation you see that Github packages must be installed with devtools. I have had the same issue you face because I had packages installed with remotes or pak, simply reinstall the packages locally you need using either install.packages for CRAN versions and devtools for dev versions and re-deploy:

install.packages("openxlsx")
# install.packages("devtools")
devtools::install_github("daattali/shinyjs")
JohnCoene
  • 2,107
  • 1
  • 14
  • 31