Skip to content

Line numbers and file names in error messages are wrong #852

@arencambre

Description

@arencambre

Line numbers returned by rmarkdown::render_site are usually incorrect. For example, I am right now trying to build the R for Data Science book (Github repo). When the build gets to rmarkdown-formats.Rmd, I get an error saying that I am missing a package called leaflet in lines 34-35. This error is at the bottom of build output.txt.

Here's the problem:

  • Lines 34-35 have nothing to do with loading any library. Line 34 is blank, line 35 is just ```yaml. (full file, and yes, the line numbers there match the line numbers indicated in RStudio)
  • Leaflet is first loaded on line 164.

I have built a few publicly available books in the past few days, and I have seen this bug multiple times.

To reproduce this one, download the R4DS book and try to build it. Make sure you do not have the leaflet package installed.

xfun::session_info('rmarkdown') output: session info.txt


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions