I'm having trouble trying to set up rmarkdown to work within VSCode.
I have tried Sys.setenv(RSTUDIO_PANDOC = "path"), but if I set it to the same path that R Studio successfully uses, if I do rmarkdown::pandoc_available() it still returns [1] FALSE.
I have also tried setting it as an environment variable in my VSCode settings.json. Again, I can knit with no problems from R Studio. I have looked at many answers to similar questions here on StackOverflow, but none of them have worked for me thus far. I am running Windows 10.
EDIT:
r$> Sys.getenv("RSTUDIO_PANDOC")
Returns
[1] "C:/Program Files/RStudio/bin/quarto/bin/tools/pandoc.exe"
I have tried running
Sys.setenv(RSTUDIO_PANDOC = "C:/Program Files/RStudio/bin/quarto/bin/tools/pandoc.exe")
My settings.json file includes this
"terminal.integrated.env.windows": { "RSTUDIO_PANDOC":"C:/Program Files/RStudio/bin/quarto/bin/tools/pandoc.exe" }
Add the pandoc folder to your Path environment variable:
C:\Program Files\RStudio\bin\quarto\bin\tools\. It should be at the bottom of the listThis is based on https://github.com/rstudio/rmarkdown/issues/289, which I interpret as advising to use the Path environment variable rather than the RSTUDIO_PANDOC environment variable when outside RStudio.
Just keeping this up to date - as of RStudio build 2024.04.2 (and possibly earlier) you now need to point your path to C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools.
In case it trips someone else up, you need to use RSTUDIO_PANDOC as the variable name. Restart VSCode and you should be good
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With