Closed shumza-nali closed 2 months ago
@VincentGuyader @ColinFay Do you have an ideas on what could be going wrong?
hi,
I use renv a lot, but not for shinyserver (although that shouldn't matter).
I don't quite understand the issue. What is shinyserver supposed to do with the renv.lock file? I assume you need to add renv::activate()
in the app.R
Have you managed to use shinyserver + renv + a simple app.R (outside of golem, I mean)?
Regards
Many thanks for your response @VincentGuyader
My company has a new server. The old server would not deploy the App until I used renv (then it worked for the golem app).
When I add renv::activate()
in app.R and run the app with shiny::run_App()
I get the error below, and it restarts the R session and loads my project.
Error in func(fname, ...) : app.R did not return a shiny.appobj object.
I can say the following after further testing:
renv::init()
and renv::isolate()
).renv::snapshot()
I am choosing the explicit mode (from DESCRIPTION file) with the following as Imports:Imports:
config (>= 0.3.2),
golem (>= 0.4.1),
pkgload,
shiny (>= 1.8.0)
Many thanks
EDIT:
Another interesting observation:
shinyserver + simple app.R + renv with library(golem) in app.R. Once I call renv::snapshot()
and renv::isolate()
, the deployed app works. So I don't think there is an issue with the dependency of the App, rather the way the golem framework deploys the app.
@VincentGuyader I think I have found the source of the bug. You should be able to reproduce this.
THE BUG: when initiating renv inside a golem project an renv folder is created inside the project without a library.
Instead, the library is created in the cache directory '/home/myuser/.cache/R/renv/library/myproject'. This does not happen with a simple shiny app.R (outside of Golem).
This leads me with two questions:
Many thanks
https://github.com/rstudio/renv/issues/384#issuecomment-611785515
Found the answer here. I had to specify my RENV_PATHS_LIBRARY in project .Renviron.
I wonder why I had to do this in the first place? Why was this not the default and the .cache directory was?
Describe the bug
I am attempting to deploy my app on a company hosted shiny server with renv to isolate the environment.
Apps which are not developed with the golem framework are deploying fine, whereas any App built with the golem framework does not deploy.
The app runs with
golem::run_dev()
.In my log file it states there is no package called
jsonlite
but I have installedjsonlite
withinstall.packages()
and I can see it in the renv lock file.To reproduce
New golem project. Install with standard instructions here.
Navigate to
03_deploy.R
. No errors withdevtools::check()
. Package installed withdevtools::install()
and is able to run withrun_app()
. I am using the shinyserver file functiongolem::add_shinyserver_file()
.Initiate renv with
renv::init()
, isolate and restore withrenv::isolate()
andrenv::restore()
respectively.Session Info
haliTest4_0.0.0.9000
is the name of the App.log