Error when knitting default RMarkdown file in RStu

2019-06-26 07:32发布

问题:

I am using RStudio version 1.1.456, which is running R version 3.5.1. I am running on Windows 7 Enterprise, 64-bit.

I'm new to using R Markdown, and so when I opened a new R Markdown file in RStudio, I thought it would be good to run the default code before I tried anything myself. (Note: this is the code that is automatically populated when opening a new Rmd file).

---
title: "test"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

When I tried to knit this default code, I get the following error:

pandoc.exe: Could not fetch \\VAULT24\HOME24$\rosnerta\My Documents\R\win-library\3.5\rmarkdown\rmd\h\jquery-1.11.3\jquery.min.js
FailedConnectionException2 "VAULT24" 80 False connect: failed (Connection timed out (WSAETIMEDOUT))
Error: pandoc document conversion failed with error 67
Execution halted

This error occurs both when I use the render function, and when I press the knit button.

I've searched the various error messages and have not found anything helpful/relevant. I have installed the knitr, rmarkdown, and markdown packages. I have also checked that file path provided in the error message does exist, and indeed, it does.

If anyone could help me figure out why this is happening, I would be very appreciative. I would really like to get in the habit of using R Markdown for my work, but I doubt that will be possible if even the default code won't knit.

Not sure if this is helpful, but here is my session info:

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rmarkdown_1.10

loaded via a namespace (and not attached):
 [1] compiler_3.5.1  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2 htmltools_0.3.6 tools_3.5.1     yaml_2.2.0      Rcpp_0.12.18    stringi_1.1.7   knitr_1.20      stringr_1.3.1   digest_0.6.16   evaluate_0.11  

Thanks in advance.

回答1:

There has been a lot of talks about pandoc error 67 since 2014. You can find some of that in the following links: (one, two, three, four). The only workaround I heard about is disabling self-contained (self_contained: no)

I hope that help.

title: "test"
output: 
  html_document:
    self_contained: no


回答2:

Delete the folder R is trying to access

First, delete the "R"-folder on:

\VAULT24\HOME24$\rosnerta\My Documents\R\win-library\3.5\rmarkdown\rmd\h\jquery-1.11.3\jquery.min.js

It looks like a network drive, which R can't access. I had a similar problem, and deleting the R-folder, at that location, solved my issue.

Then, install R into a folder on the desktop, or somewhere else, where you have total rights. Then it should be possible to knit standalone HTML-documents.