Openscapes / quarto-website-tutorial

Example quarto site without R or Python
https://openscapes.github.io/quarto-website-tutorial
Creative Commons Attribution 4.0 International
49 stars 90 forks source link

Build-deploy error #20

Closed BrendanTurley-NOAA closed 1 year ago

BrendanTurley-NOAA commented 1 year ago

Hello, I have been following the tutorial and it was working until I added an Rmd file. Github actions failed with the message: Error in loadNamespace(x) : there is no package called ‘jsonlite’

I changed the .Rmd to .qmd and changed some syntax but that did not fix the issue.

I noticed you had a similar issue, but it is not clear how this can be resolved. What is going on and how can I fix it?

jules32 commented 1 year ago

Hi @bdturley !

Thanks for posting and providing links!

This error is because your r-example.qmd has R code in it, and the GitHub Action from the tutorial book is not set up to expect R.

I created a pull request with the update you need: https://github.com/bdturley/quarto-test-drive/pull/1. It does the following:

To update your GitHub Action to include R code, you can add the following to your quarto-publish.yml (referenced from quarto-dev's github):

- name: Install R
  uses: r-lib/actions/setup-r@v2
  with:
    r-version: '4.2.0' # The R version to download (if necessary) and use.
BrendanTurley-NOAA commented 1 year ago

Thanks for the patch @jules32. But it still didn't work. I did get it to work by also adding:

- name: Install rmarkdown
   run: |
      install.packages("rmarkdown")
   shell: Rscript {0}

The error message keep saying the rmarkdown was not there, so I searched around to see how to install packages. However, the build took almost 7 minutes. That seems like alot and I am wondering if there is a better way to do this especially if the code has a lot package dependencies.

My takeaway is that maybe this quarto-github pages is best used for content and not complex R code. I am curious to see your thoughts on this.

BrendanTurley-NOAA commented 1 year ago

I really appreciate the time you took to help me out @jules32!

As an update to my previous comment, Github caches so the build took less time the sequent builds. I enjoyed very much the OpenScapes sessions this summer. Thanks to everyone's hard work and dedication!

Cheers!

jules32 commented 1 year ago

Hi @bdturley !

Glad you got past this particular issue but that is strange that it took so long. And cool to learn about the cache as well - I haven't played around with that. I (ironically?) don't have a lot of experience with github-actions with R! We've mostly used github-actions with "freezing" python code and for repos with no code at all (besides quarto).

If the slowness continues, I wonder if you want to try quartopub (https://quartopub.com/), which is native quarto publishing!