When I try to run my .Rmd document I get an error :
Output created: /tmp/RtmpIJCtdZ/file443d7655998c.html
Warning: Error in value[[3L]]: Couldn't normalize path in addResourcePath, with arguments: prefix = 'mathjax-local'; directoryPath = '/usr/lib/rstudio-server/resources/mathjax-26'
122: stop
121: value[[3L]]
120: tryCatchOne
119: tryCatchList
118: tryCatch
117: shiny::addResourcePath
116: shinyHTML_with_deps
115:
99: doc
98: shiny::renderUI
97: func
84: origRenderFunc
83: output$reactivedoc
3:
1: rmarkdown::run
I have tried to update all packages and run , still it did not work.
Using the environment it was created in using renv() was the solution. Looks like the issue was with updated packages.
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! Error in .shlib_internal(commandArgs(TRUE)) :
C++14 standard requested but CXX14 is not defined
Calls: <Anonymous> -> .shlib_internal
Execution halted
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command 'C:/PROGRA~1/R/R-36~1.0/bin/x64/R CMD SHLIB file1a1860a0379.cpp 2> file1a1860a0379.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
Some non-English page said that we can overcome by executing the following R script, but it did not work in my case:
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR))
dir.create(dotR)
M <- file.path(dotR, "Makevars")
if (!file.exists(M))
file.create(M)
cat("\nCXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function",
"CXX14 = g++ -std=c++1y",
file = M, sep = "\n", append = TRUE)
The above R script is same as in the following page:
https://github.com/stan-dev/rstan/issues/569
I tried to uninstall and install according to the following page, but the above error occurred.
Rstan installation: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
REF; https://github.com/stan-dev/stan/issues/1613
ref: https://github.com/stan-dev/rstan/issues/633
For me, the issue has been solved by adding manually the following line into the file .R/Makevars.win.
CXX14 = "C:\Rtools\mingw_64\bin\g++.exe"
The issue is weird in the sense that I can recreate the exact same PDF report with knitr outside of the Shiny app. The code does work if I use HTML as output format. I have the latest version from MikTex
See code below:
output$report <- downloadHandler(
filename = paste(Sys.Date(), "GebiedsRapportage.html"),
content = function(file) {
#tempReport <- file.path(tempdir(), "report_html.Rmd")
tempReport <- file.path(tempdir(), "report_pdf.Rmd")
#file.copy("report_html.Rmd", tempReport, overwrite = TRUE)
file.copy("report_pdf.Rmd", tempReport, overwrite = TRUE)
rmarkdown::render(tempReport, output_file = file)
}
)
So, using the #HTML functions works fine, but the PDF function gives me the following error:
Warning: running command '"pdflatex" -halt-on-error -interaction=batchmode "file2e8466131256.tex"' had status 1
Warning: Error in : Failed to compile file2e8466131256.tex.
Stack trace (innermost first):
58: show_latex_error
57: on_error
56: system2_quiet
55: run_engine
54: latexmk_emu
53: tinytex::latexmk
52: latexmk
51: rmarkdown::render
50: download$func [server/server_data_analysis.R#311]
1: runApp
Error : Failed to compile file2e8466131256.tex.
While knitting the file itself without interacting with Shiny generates a PDF perfectly fine.
Anyone encountered the same issue?
I have never seen this error before running a Shiny app and can't find anything about it after Googling. I've tried re-installing the shiny package and restarting R but nothing resolves it. Any insight?
Error after running runApp() from the local directory:
Listening on http://127.0.0.1:6093
Warning: Error in ..stacktraceon..: could not find function "shioptions"
Stack trace (innermost first):
1: runApp
Error in ..stacktraceon..({ : could not find function "shioptions"
Traceback below:
5: Sys.sleep(0.001)
4: withCallingHandlers(expr, error = function(e) {
if (is.null(attr(e, "stack.trace", exact = TRUE))) {
calls <- sys.calls()
attr(e, "stack.trace") <- calls
stop(e)
}
})
3: captureStackTraces(while (!.globals$stopped) {
serviceApp()
Sys.sleep(0.001)
})
2: ..stacktraceoff..(captureStackTraces(while (!.globals$stopped) {
serviceApp()
Sys.sleep(0.001)
}))
1: runApp()
Check the library("shiny") output from your R Console. I think you do not have the package loaded and/or you had an intentional upgrade.
I installed a shiny-server on Amazon AWS EC-2 (Amazon Linux AMI 2015.09.1 (HVM), SSD Volume Type - ami-60b6c60a). The server works fine for the Shiny apps, but does not render the .rmd, even the rmd from the example page.
I only see this error:
Error: error in running command
In the HTML:
<div id="__reactivedoc__" class="shiny-html-output shiny-bound-output shiny-output-error">error in running command</div>
I already installed the rmarkdown package, it works fine on Rstudio. (I use the same user for Rstudio and Shiny server).
I don't know how to get more information about the error, I don't see other messages.
Somebody have an idea?
NEW INFO:
I investigate the logs from the server:
This is the output from the /var/log/shiny-server/:
su: ignore --preserve-environment, it's mutually exclusive to --login.
Listening on http://127.0.0.1:52294
/opt/shiny-server/ext/pandoc/pandoc: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory
Warning: Error in system: error in running command
Stack trace (innermost first):
97: system
96: force
95: with_pandoc_safe_environment
94: get_pandoc_version
93: FUN
92: lapply
91: find_pandoc
90: pandoc_available
89: <Anonymous>
88: do.call
87: contextFunc
86: .getReactiveEnvironment()$runWith
85: shiny::maskReactiveContext
84: reactive reactive({
out <- rmd_cached_output(file, encoding)
output_dest <- out$dest
if (out$cached) {
if (nchar(out$resource_folder) > 0) {
shiny::addResourcePath(basename(out$resource_folder),
out$resource_folder)
}
return(out$shiny_html)
}
if (!file.exists(dirname(output_dest))) {
dir.create(dirname(output_dest), recursive = TRUE, mode = "0700")
}
resource_folder <- knitr_files_dir(output_dest)
perf_timer_reset_all()
dependencies <- list()
shiny_dependency_resolver <- function(deps) {
dependencies <<- deps
list()
}
output_opts <- list(self_contained = FALSE, copy_resources = TRUE,
dependency_resolver = shiny_dependency_resolver)
message("\f")
args <- merge_lists(list(input = reactive_file(), output_file = output_dest,
output_dir = dirname(output_dest), output_options = output_opts,
intermediates_dir = dirname(output_dest), runtime = "shiny"),
render_args)
result_path <- shiny::maskReactiveContext(do.call(render,
args))
if (!dir_exists(resource_folder))
dir.create(resource_folder, recursive = TRUE)
shiny::addResourcePath(basename(resource_folder), resource_folder)
dependencies <- append(dependencies, list(create_performance_dependency(resource_folder)))
write_deps <- base::file(file.path(resource_folder, "shiny.dep"),
open = "wb")
on.exit(close(write_deps), add = TRUE)
serialize(dependencies, write_deps, ascii = FALSE)
if (!isTRUE(out$cacheable)) {
shiny::onReactiveDomainEnded(shiny::getDefaultReactiveDomain(),
function() {
unlink(result_path)
unlink(resource_folder, recursive = TRUE)
})
}
shinyHTML_with_deps(result_path, dependencies)
})
73: doc
72: shiny::renderUI
71: func
70: output$__reactivedoc__
3: <Anonymous>
2: do.call
1: rmarkdown::run
On the /opt/shiny-server/ext/pandoc/ I have these:
-rwxrwxr-x 1 root root 37191008 Feb 3 2014 pandoc
-rwxrwxr-x 1 root root 38520576 Feb 3 2014 pandoc-citeproc
drwxrwxr-x 2 root root 4096 Jan 13 15:15 static
I tried to install "gmp.x86_64", but the results are:
> yum install gmp.x86_64
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
epel/x86_64/metalink | 3.0 kB 00:00
epel/x86_64 | 4.3 kB 00:00 ...
epel/x86_64/updateinfo | 715 kB 00:00
epel/x86_64/primary_db | 5.8 MB 00:01
949 packages excluded due to repository priority protections
Package gmp-6.0.0-11.16.amzn1.x86_64 already installed and latest version
Nothing to do
And still not working.... Maybe there is another package?
In my "/usr/lib64/" I have libgmp.so.10.2.0, but I think I don't have libgmp.so.3.
Even installing the i686 version, still the same.
For Fedora 23 I had the same problem
[root#pjux shiny-server]# ldd -d /opt/shiny-server/ext/pandoc/pandoc
linux-vdso.so.1 (0x00007ffff9eb0000)
libz.so.1 => /lib64/libz.so.1 (0x00007fc20bd55000)
librt.so.1 => /lib64/librt.so.1 (0x00007fc20bb4d000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007fc20b949000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fc20b745000)
libgmp.so.3 => not found
libffi.so.5 => not found
libm.so.6 => /lib64/libm.so.6 (0x00007fc20b442000)
libc.so.6 => /lib64/libc.so.6 (0x00007fc20b081000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc20ae63000)
/lib64/ld-linux-x86-64.so.2 (0x0000561bb7c14000)
but
ln -s /lib64/libffi.so.6.0.2 /lib64/libffi.so.5
ln -s /lib64/libgmp.so.10.2.0 /lib64/libgmp.so.3
solved it
I solved the problem with help from the github issues page of shiny-server
How sjpascual said, just install the packages: compat-gmp4 and compat-libffi5 to fix it.
Now is working fine.
This is an old post but in case someone has a similar problem. You may try to install the RMarkdown package from console as root instead of inside RStudio to make the package available to the Shiny server:
sudo su - -c "R -e \"install.packages('rmarkdown', repos='http://cran.rstudio.com/')\""
That helped me to get the RMarkdown sample app in the test page to load...
For CentOS 7, installing gmp-devel and libffi-devel and restarting Shiny Server resolved the issue.