1

Wrote a previous question related to rendering a quarto document with a .cmd file (quarto_render broken from .bat / .cmd file), but with the recent updates to RStudio, the pathing has changed as well as the commands needed for rendering a quarto doc as html, and I am once again stuck.

Much like before, this is a multi-step process, though I think I have a better understanding, thanks to the previous responses. For one thing, learned that the quarto render executable is from RStudio, not from R, which means updates to the RStudio IDE have a greater impact on the rendering process than R language updates.

RStudio version

(RStudio 2022.12.0+353 "Elsbeth Geranium" Release (..., 2022-12-03) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36)

R Version (4.2.2)

File 1 - test_doc.qmd

  • Create a new .qmd document (I called mine test_doc.qmd).
  • Set to an output of html, and kept default YAML and other text. No modifications.

File 2 - test.cmd

After running the first two lines in the command prompt, and PAUSE the Error output is written below. This is a vexing error, since I've tried various iterations of the code below to account for this error, but then keep getting other error messages

{Command Prompt}

D:
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" render "C:\Users\%usernmae%\OneDrive - ...\Projects\Test\test_doc.qmd" PAUSE

ERROR: Error executing 'Rscript': program not found

Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/

Results of Quarto Check in RStudio Terminal

[>] Checking Quarto installation......OK
      Version: 1.2.269
      Path: d:\Program Files\RStudio\resources\app\bin\quarto\bin
      CodePage: 1252

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....(None)

      Unable to locate an installed version of Python 3.
      Install Python 3 from https://www.python.org/downloads/

[>] Checking R installation...........OK
      Version: 4.2.2
      Path: D:/Program Files/R/R-4.2.2
      LibPaths:
        - D:/Program Files/R/R-4.2.2/library
      rmarkdown: 2.20

[>] Checking Knitr engine render......OK

Results of Quarto Check in Command Prompt

{Command Prompt}
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" check

[>] Checking Quarto installation......OK
      Version: 1.2.269
      Path: D:\Program Files\RStudio\resources\app\bin\quarto\bin
      CodePage: 1252

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....(None)

      Unable to locate an installed version of Python 3.
      Install Python 3 from https://www.python.org/downloads/

[>] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

Although, there is an install of 4.2.2 located in the D drive as well...

and quarto.exe --help in RStudio Terminal

quarto.exe --help

  Usage:   quarto
  Version: 1.2.269

  Description:

    Quarto CLI

  Options:

    -h, --help     - Show this help.
    -V, --version  - Show the version number for this program.

  Commands:

    render          [input] [args...]     - Render files or projects to various document types.
    preview         [file] [args...]      - Render and preview a document or website project.
    serve           [input]               - Serve a Shiny interactive document.
    create          [type] [commands...]  - Create a Quarto project or extension
    create-project  [dir]                 - Create a project for rendering multiple documents
    convert         <input>               - Convert documents to alternate representations.
    pandoc          [args...]             - Run the version of Pandoc embedded within Quarto.
    run             [script] [args...]    - Run a TypeScript, R, Python, or Lua script.
    add             <extension>           - Add an extension to this folder or project
    install         [target...]           - Installs an extension or global dependency.
    publish         [provider] [path]     - Publish a document or project. Available providers include:
    check           [target]              - Verify correct functioning of Quarto installation.
    help            [command]             - Show this help or the help of a sub-command.

Results in Command Prompt

{Command Prompt}
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" --help

  Usage:   quarto
  Version: 1.2.269

  Description:

    Quarto CLI

  Options:

    -h, --help     - Show this help.
    -V, --version  - Show the version number for this program.

  Commands:

    render          [input] [args...]     - Render files or projects to various document types.
    preview         [file] [args...]      - Render and preview a document or website project.
    serve           [input]               - Serve a Shiny interactive document.
    create          [type] [commands...]  - Create a Quarto project or extension
    create-project  [dir]                 - Create a project for rendering multiple documents
    convert         <input>               - Convert documents to alternate representations.
    pandoc          [args...]             - Run the version of Pandoc embedded within Quarto.
    run             [script] [args...]    - Run a TypeScript, R, Python, or Lua script.
    add             <extension>           - Add an extension to this folder or project
    install         [target...]           - Installs an extension or global dependency.
    publish         [provider] [path]     - Publish a document or project. Available providers include:
    check           [target]              - Verify correct functioning of Quarto installation.
    help            [command]             - Show this help or the help of a sub-command.

Needless to say, any help with this would be greatly appreciated. Have tried variations on the theme above, but am really struggling with figuring this process out. Thank you for the assist!

James Crumpler
  • 192
  • 1
  • 8
  • To run the check you did `"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" check`? Or something else? Are you running these commands at the RStudio terminal? Or a stand alone command prompt? – MrFlick Feb 15 '23 at 21:39
  • Great question, I ran the check in RStudio Terminal ...>quarto check – James Crumpler Feb 15 '23 at 23:11
  • What happens if you run quarto check outside of rstudio? I’m guessing it won’t be able to find R. I think rstudio adjusts your path environment variable to include additional runtimes. If you are trying to run outside of R, make sure to add the R folder to your system path environment variable. – MrFlick Feb 16 '23 at 00:57
  • MrFlick made edits in the question above – James Crumpler Feb 16 '23 at 11:58
  • You seem to have ran `quarto.exe" check --help` rather than `quarto.exe" check`. It's not that useful to see the help page, we want to see the output of the `check` module. – MrFlick Feb 16 '23 at 13:58
  • Thank you for the assistance, just edited the above code to reflect a quarto.exe check, rather than just the help documentation – James Crumpler Feb 16 '23 at 14:20
  • 1
    So as the output of `check` on the command prompt indicates, it cannot find R. As [mentioned in the docs](https://quarto.org/docs/computations/r.html#installation), `quarto` will look for R on your system path. You usually find the correct path by running `R.home("bin"))` at the R console. Here's a general guide for adding something to your PATH https://www.hanss.info/sebastian/post/rtools-path/ just make sure to use your actual path, and not the old one used in that article. If it worked, you should be able to run `R --version` in a new command prompt and see some output, not an error. – MrFlick Feb 16 '23 at 15:29
  • That resolved the issue, going to create a write-up for work now too, but I could sing your praises, thank you so much!! – James Crumpler Feb 16 '23 at 17:21

0 Answers0