简体   繁体   中英

learnr application doesn' work on shiny server

I'm a beginer with shiny server. I've installed it on my computer and I get the default app working correctly on http://localhost:3838/sample-apps/rmd/ .

However, I've tried some learnr apps (that I copied in the /srv/shiny-server/sample-apps/rmd/ directory) which all failed with the message : "An error has occured. Check your logs or contact the app author for clarification"

The log file on /var/log/shiny-server says (as far as I understand it) that the learnr package is not installed, although it actually is and the learnr apps works perfectly on my computer while launched from RStudio.

--

Warning: Error in : package or namespace load failed for 'learnr':
    .onAttach failed in attachNamespace() for 'learnr', details:
    call: NULL
    error: The shiny_prerendered_chunk function can only be called from within runtime: shiny_prerendered
    139: stop
    138: value[[3L]]
    137: tryCatchOne
    136: tryCatchList
    135: tryCatch
    134: library
    133: eval
    132: eval
    127: evaluate_call
    126: evaluate::evaluate
    125: evaluate
    123: block_exec
    122: call_block
    121: process_group.block
    118: process_file
    117: knitr::knit
    116: <Anonymous>
    111: <reactive>
    95: doc
    94: shiny::renderUI
    93: func
    80: origRenderFunc
    79: output$__reactivedoc__
    3: <Anonymous>
    1: rmarkdown::run

I had exactly the same problem. In fact, the issue is not that you did not install learnr properly; your issue is actually a namespace issue. It can be solved by installing the tidyverse package with install.packages("tidyverse") directly on your server machine.

Best wishes.

I had the same error message. However, I tried to deploy exercise.Rmd on an Ubuntu machine (18.04 x64) running the latest versions of R, RStudio server and ShinyServer. The deployment folder, which caused the error was sub-folder da of /opt/shiny-server/samples/sample-apps/ . That means, http://r.smartana.org/sample-apps/da/exercise.Rmd showed an error.

My solution was to create a folder having the same file-name as the folder-name and add the corresponding html file. That means, in the sample-apps folder I added exercise/exercise.Rmd and exercise/exercise.html . Now this can be accessed via http://r.smartana.org/sample-apps/exercise/ and http://r.smartana.org/sample-apps/exercise/exercise.Rmd (but not via the html extension).

Lessons learned :

  1. deployment file-name and its folder-name must be identical;
  2. corresponding html-file is required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM