alishinski / lavaanPlot

R package for plotting lavaan path models with DiagrammeR
http://alexlishinski.com/lavaanPlot/
38 stars 4 forks source link

"invalid 'path' argument" error when building lavaanPlot vignette on GitHub actions #42

Closed rempsyc closed 1 year ago

rempsyc commented 1 year ago

Dear Alex,

Thank you for creating the lavaanPlot package. I am using it with a simple wrapper with specific default parameters in my new lavaanExtra package. Unfortunately, one of my vignette is failing when using lavaanPlot, but only on macOS and Windows on GitHub actions, not locally on Windows.

This is the GitHub action error:

Quitting from lines 22-24 (test.Rmd) 
Error: Error: processing vignette 'test.Rmd' failed with diagnostics:
invalid 'path' argument
--- failed re-building 'test.Rmd'

And this is the vignette using the default doc example of lavaanPlot: https://github.com/rempsyc/lavaanExtra/blob/main/vignettes/test.Rmd

I was wondering if you would have any idea as to what may be causing this issue, and how to fix it?

I have already opened a discussion on RStudio, if that may be helpful: https://community.rstudio.com/t/error-processing-vignette-indirect-rmd-failed-with-diagnostics-invalid-path-argument/146260/4

alishinski commented 1 year ago

Hi, glad you like the package! I'm not sure exactly what's going on here, but I've had all manner of issues with building vignettes lately. Is this the only one of your vignettes that's not working?

When I googled "Error: processing vignette: invalid 'path' argument" I did find some other examples of packages getting the same error under some system configurations. One common theme I noticed is that they all seem to be packages that do some kind of plotting with javascript using the htmlwidgets package, which is what diagrammeR is using too. E.G.:
https://mran.microsoft.com/snapshot/2021-08-04/web/checks/check_results_slickR.html https://github.com/r-spatial/sf/issues/1632

My best suggestion at the moment, to try to more narrow it down a little, would be to see if it will render the vignette if you assign the lavaanPlot to a name. My suspicion at this point is that it's something to do with the way that it's rendering the plot and perhaps it's trying to find some path to keep it at that it's not able to resolve on macOS or Windows within whatever the github actions parameters are. But I really don't know. I wish I had a more helpful answer. Happy to try to help more if you get further down the road with this.

rempsyc commented 1 year ago

Thanks! Yes, that's my only vignette that is failing GHA (it is "working" otherwise). And that's interesting, because on your vignettes, you don't save the plots as objects beforehand, you just print them directly. Furthermore, your own GHA are not failing for your plots, so I'm confused as to what we do differently. In any case, I just tried saving them to an object named "plot" and then printing that object, but same error.

I also tried changing %\VignetteEngine{knitr::knitr} to %\VignetteEngine{knitr::rmarkdown} like in your vignettes, and then get no error, but instead a warning suggesting that the vignettes are not being built at all (any idea?):

Warning: Files in the 'vignettes' directory but no files in 'inst/doc':

Finally, Gabor asked

What kind of image file is knitr supposed to generate here? Maybe you can set a different graphics device, because the one you are using (possibly the default?) is not working for some reason.

What would you answer to that? How would you change the graphics device?


Btw, the image on your readme is not rendering properly on your pkgdown site: https://lavaanplot.alexlishinski.com/

rempsyc commented 1 year ago

Oh and another interesting thing: I've had to add webshot as a suggested dependency to get rid of a GHA error like in the link you posted, but I see that you don't even use that. How did you do it?

rempsyc commented 1 year ago

Ok so because of some mysterious magic, adding back %\VignetteEngine{knitr::rmarkdown} made the GHA run without any error or warnings this last time... Strange!!!! But as long as it works, I am relieved... 😪😌🤗

alishinski commented 1 year ago

Well, I'm glad you were able to get it to work, even if you don't know why! I also appreciate directing my attention to the vignette engine command as perhaps the reason I've been having trouble with the vignettes.

As for the webshot thing, it seems like the connection is likely that knitr has that as a suggest which it in some cases uses to grab the type of rendered html/js output of the sort that diagrammeR creates, which shows up in the viewer tab normally. So I'd have to guess that changing the vignette engine created a situation where you needed webshot.