Actually the default strategy is M-K, which means you can configure one set up chunk in index.Rmd and all other following chapters will share that setting. The bookdown book says:
The most significant difference is that M-K runs all code chunks in all chapters in the same R session, whereas K-M uses separate R sessions for individual chapters. For M-K, the state of the R session from previous chapters is carried over to later chapters (e.g., objects created in previous chapters are available to later chapters, unless you deliberately deleted them);
To switch to the K-M approach, create a file named _bookdown.yml under your root directory and add the field new_session: yes. If you do this, then each chapter will need its individual setup chunk in their Rmd file respectively. However, another option is use the before_chapter_script field in _bookdown.yml. For example before_chapter_script: foo.R will let bookdown execute code inside foo.R each time before it starts to knit individual Rmd files, so that you can still put your setup chunk only in one place. If you want to load tidyverse without having to call it in each chapter, just use library(tidyverse) in foo.R.
That said, it seems tidyverse isn't installed according the error message. Could you run install.packages("tidyverse") and try again? Or did you look up how to publish book through netlify?
Thanks, enixam. It appears that it was mostly a problem with GitHub Actions, which I was using to push to Netlify. It turns out that this approach is much slower (4-7 min) and buggier (it could not find tidyverse) than the drag and drop strategy for netlify espoused by Alison Hill here: Sharing on Short Notice: How to Get Your Materials Online With R Markdown - RStudio
Now working fine with same Rmd files, using drag and drop strategy to Netify.
Thanks for your explication of M-K vs K-M. I think I may end up going with K-M, rather than trying to keep track of all libraries across multiple chapters and updating them in index.Rmd.
The takeaway here may be to always follow Alison Hill's advice on Rmd.
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: