Building a Bookdown book fails with Error 127

rmarkdown
bookdown

#1

I'm trying to build a bookdown book in rstudio.cloud because I think the idea of authoring an R book using a Chromebook is pretty amazing. However, when I try to build the book using the "build website" button in the GUI I get the following error:

==> rmarkdown::render_site(encoding = 'UTF-8')

R -e 'bookdown::render_book("index.Rmd", output=bookdown::gitbook())'
Makefile:5: recipe for target 'book' failed
make: R: Command not found
make: *** [book] Error 127
Error in render_book_script(output_format, envir, quiet) :
Error 2 attempting to render book
Calls: -> -> in_dir -> render_book_script
Execution halted

Exited with status 1.

Error 127 possibly indicates that R can't find the compiler, maybe? Based on this: https://github.com/metrumresearchgroup/mrgsolve/issues/160

Other clues online make me think maybe this is an issue with not having enough RAM: https://stackoverflow.com/questions/34687030/pandoc-document-conversion-failed-with-error-127

Any tips on how to avoid the error?


#2

I forked the bookdown demo ( https://github.com/rstudio/bookdown-demo ) and then started a new project from the demo repo. The demo builds without error. Soooo... I'm thinking this means that my book is just too damn big?

image

Any tips on how I might talk sweet to the cloud instance in such a way as to help my book build?

I'm already using Knit-Merge by setting new_session: yes in my _bookdown.yaml file. And I can build each chapter individually without error. So maybe there's an issue in the merge step? Ideas?


#3

I was able to build R for Data Science after working around some issues, so it works for non-trivial demos as well.

I'd be happy to take a closer look if you want to private message me a link to your project.


#4

good thinking to build R4DS... I had worked through those issues recently and built the book on my local machine. I should have thought to try that. I will DM you a link to my project.


#5

Thanks to a little out of band chat with Josh, we discovered the issue was, indeed, a path issue. For some reason the path to R was not in the PATH. So I ran this from within R:

Sys.setenv(PATH = paste('/opt/R/3.4.4/bin/:', Sys.getenv("PATH"), sep=''))

Which worked because I am running R 3.4.4.

FWIW, my path before running the above command was as follows:

> Sys.getenv("PATH")
[1] "/home/rstudio-user/bin:/home/rstudio-user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"