Closed jankowtf closed 9 years ago
Does it work if you do not set any opts_chunk
options? I guess the answer is probably no, since I was seeing the error as well on Windows today... It might be a bug in rmarkdown. I'll try to verify it tomorrow. Thanks for the feedback!
Thanks for the fast reply! Yap, also checked it without the opts_chunk
, that's in fact what I tried first. Thanks for taking this on!
For some reason, I cannot reproduce the problem now on Windows. I'm using RStudio 0.98.1073: http://www.rstudio.com/products/rstudio/download/ with knitr and rmarkdown installed from Github:
devtools::install_github(c('yihui/knitr', 'rstudio/rmarkdown'))
Could you try the latest versions of RStudio, knitr and rmarkdown? Thanks!
Hm, that's strange. I still get the error, even after updating to the newest versions.
I'm on RStudio 0.98.1073 and this is my sessionInfo
:
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.6.22
loaded via a namespace (and not attached):
[1] digest_0.6.4 evaluate_0.5.5 formatR_1.0 htmltools_0.2.6 rmarkdown_0.3.8
[6] stringr_0.6.2 tools_3.1.1
I have exactly the same session info as yours, but still could not reproduce the problem. I noticed one possible culprit, though: you installed R in the Q: drive, and I guess that is a network drive? If that is the case, rmarkdown might have failed to copy the jquery library from Q: to C:.
You can set
output:
html_document:
self_contained: no
in the YAML metadata and see if rmarkdown has copied the js/css dependencies to the test_files directory, which should exist in the same directory as your Rmd file.
Yes! That fixed it, thank you so much!
A short explanation with respect to my infrastructure: I'm a fan of keeping my development infrastructure as portable as possible. That's why I installed the following tools/apps to a portable SSD drive that I can carry around instead of only on one machine (desktop, laptop ect.)
profile
file to have the Git HOME directory on the portable drive as well: HOME="/.home"
)That way, I'm pretty much independent from the machine that I'm working on. Usually works a treat, but sometimes things like this come along ;-)
In that respect and just as a "nice to have" idea: would it be possible to optionally change RStudio's HOME directory (i.e. C:/Users/{user-name}/AppData/Local/RStudio-Desktop
)? Currently, that's the only thing that "leaves traces" on the host machine I'm working on :-)
Thanks a lot again!
I was not aware of the RStudio HOME directory. Usually I work with RStudio Projects instead of some random R scripts and documents in a new RStudio session. In that way, RStudio sets the working directory to the project directory on start-up, and I do not need to worry about something like the HOME directory. I guess an RStudio project is portable, although I have never tried it in a portable SSD drive. Anyway, I'm glad that we finally found out the problem!
I started to get this issue when I recently updated my packages. Everything we work fine before until I updated. I'm not sure which version I was running before, not not sure if I can even find out at this point. Let me know if I can.
I can use knitr if i'm working from a local drive or if I have not saved the Rmd file. However by default it does not work from my NAS mounted drive.
It will work from the NAS drive if I use:
output:
html_document:
self_contained: no
The only problem I have with this workaround is that I can't publish to RPubs. The publish option isn't available using this output configuration.
I made a RStudio project on the network drive and knitr gave the same error.
sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] digest_0.6.8 htmltools_0.2.6 rmarkdown_0.5.1 tools_3.1.2 yaml_2.1.13
The error output is:
output file: RepData_PeerAssessement2_StormDataAnalysis_template.knit.md
/usr/lib/rstudio/bin/pandoc/pandoc RepData_PeerAssessement2_StormDataAnalysis_template.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output RepData_PeerAssessement2_StormDataAnalysis_template.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template /home/hiro/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/default.html --variable 'theme:bootstrap' --include-in-header /tmp/Rtmpc4qs0Q/rmarkdown-str324231b6e220.html --mathjax --variable 'mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --no-highlight --variable highlightjs=/home/hiro/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/highlight
pandoc: RepData_PeerAssessement2_StormDataAnalysis_template.html: hClose: does not exist (Host is down)
Error: pandoc document conversion failed with error 1
In addition: Warning message:
closing unused connection 5 (repdata-data-StormData.csv.bz2)
Execution halted
The current work around that gives me the RPubs publish feature is to work from my local hard drive. Which is not an ideal situation for my preferred workflow.
$ uname -a
Linux deathscythe 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
After a recent update knitr no longer works from my NAS shared drive folder that I have mounted. It was working fine before. The current work around to is use a local drive.
I cloned the current git repository to my NAS working folder, loaded the project, and ran the command.
knit2html("test.Rmd")
Which worked without error.
Knitr it is working wihout a problem using my NAS. I opened up another RStudio instance and tried the previous files which were giving me the error.
I'll try to make a new RMarkdown fiile and see if I can reproduce the error.
1 set NAS folder as working directory 2 file -> new file -> New R Markdown 3 with default templates loaded -> Knit HTML 4 close preview window 5 ctrl+s -> save file as test -> save 6 Knit HTML -> preview window opens
Welp it's working now, but wish I could figure out what the root cause of that intermittent problem.
Going to close RStudio and repeat above... result = PASS
¯(°_o)/¯
Will restart my machine and double check. If I don't come back all is fine.
Woot :( it did come back...
Going to try to install knitr from github...
result: fail
result: fail
knit2html("test.Rmd")
results: pass
results: fail
I'm having a similar issue. When I save I can no longer generate an html document with error code: Error: 1:32: unexpected input
> sessionInfo()
R version 3.1.2 (2014-10-31)Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rmarkdown_0.3.11 knitr_1.9
loaded via a namespace (and not attached):
[1] digest_0.6.8 evaluate_0.5.5 formatR_1.0 htmltools_0.2.6 stringr_0.6.2 tools_3.1.2
[7] yaml_2.1.13
@ben-williams Sorry I have no idea what the error message means. Can you keep your software versions up-to-date?
update.packages()
I updated everything yesterday with the same results. However, I've found that if I move the source .Rmd file into another folder it will run... seems the one particular project folder is "hidden"?
@ben-williams Hmm. That is interesting. Is your original folder still there? If it is, can you list all files and directories using list.files(all.files = TRUE, recursive = TRUE)
to see if there is anything suspicious? Or search for rpubs.upload.method
among files in that directory.
There was an RProfile file that had one line in it rpubs.upload.method="internal"
I deleted that file and things are working now.
Thanks for your assistance!
@ben-williams Glad you figured it out!
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
Hi Yihui,
after upgrading to the latest package versions of
knitr
and its dependencies (see version info below) yesterday, I ran into the following problem:When I create an
Rmd
doc, I can knit it as long as it has not been saved to disk. Once I do so, I get the following error:This line
gave me reason to believe that it might some something to do with caching? I've looked into these posts (post 1, post 2) and tried the following things:
opts_chunk$set(cache=TRUE, cache.path = 'test_files/', fig.path='figure/')
knitr::opts_chunk$set(cache=TRUE)
knitr::opts_chunk$set(cache=FALSE)
but unfortunately none seems to do the trick.
My
Rmd
fileIt's simply the template as created when creating a new
Rmd
file viawith this additional chunk before the YAML part:
require("knitr") opts_chunk$set(cache=TRUE, cache.path = 'test_files/', fig.path='figure/')
(of course including the opening and closing ```; somehow I can't wrap two code chunks into another here)
Version infos
The only thing that works is knitting a Word document. I've checked that MikTeX's
bin
directory is contained in my WindowsPATH
variable, but trying to knit to either HTML or PDF fails with the above error.Thanks a lot for looking into this and thanks again for creating
knitr
! :-)