Cannnot open Rnw file after R update to 4.4.0 - (TypeError): Cannot read properties of undefined (reading `count`)
Asked Answered
P

2

10

I recently upgraded to R version 4.4.0 (2024-04-24 ucrt) and also updated the R version in RStudio via the global options.

Since the update, I am unable to open Rnw (RSweave) files. When attempting to do so, I encounter the following error message:

enter image description here

So far, I have tried installing and updating all the relevant packages such as

  • install.packages("knitr")
  • install.packages("rmarkdown")
  • tinytex::reinstall_tinytex() tinytex::tlmgr_install("listings")
  • update.packages(checkBuilt = TRUE, ask = FALSE)

but still couldn't fix the issue. I googled it further, and I found this Github Issue related to "storybook"(https://github.com/storybookjs/storybook/issues/23787), but I am not sure if this is relevant to my case.

Could I get some insights on how to solve this issue?

Panamerican answered 1/5 at 17:11 Comment(3)
What version of RStudio are you using? Can you create a new Rnw file in RStudio? Are you prevented from opening them all, or only one particular file?Bono
@Bono Thank you for asking! I am using the most recent version of the RStudio. I can create a new Rnw files, but I cannot open any Rnw files. I could open the exact same Rnw files in RStudio on a different computer, but not on my PC.Panamerican
@Bono Removing and reinstalling R and RStudio did not resolve the issue. However, I discovered that the same error message appears when I use curly braces, { and }, in a code chunk within a newly created Rnw file. I suppose the curly braces might be the source of the problem.Panamerican
K
10

I had the same issue with an older version of R, so it is definitely an RStudio problem.

I installed the previous version from here: https://docs.posit.co/previous-versions/rstudio/

I am sure there will be a patch quite soon and you can upgrade again to the newest version of RStudio.

Keniakenilworth answered 2/5 at 9:0 Comment(2)
You are right! After downgrading the RStudio to 2023.12.1 version, I can open the Rnw files again. Thank you very much!!!Panamerican
@jjmerelo you can follow the issue here: linkKeniakenilworth
K
0

I was able to take the .tex file of a .rnw (that didn't inclcude any R code), and copy/paste that into a new file, delete the extras that were added by Sweave, and it ran. Did not work very well for a file that had code chunks though.

Kiersten answered 8/5 at 16:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.