Rstan or C++ Toolchain Error

Operating System: Windows
Interface Version: 2.19.2
Compiler/Toolkit: ???

I’m trying to install RStan, so that I can use the ‘rethinking’ package that comes with the textbook ‘Statistical Rethinking’. I’m following the instructions from this website:
When I get to ‘Checking the C++ Toolchain’ and use this code: ‘pkgbuild::has_build_tools(debug = TRUE)’,
I get an error in R that says:
‘Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘fansi’’

I am a novice and know very little about RStudio. Any help is much appreciated.

You should first do


but I don’t know why.

Thank you! That worked for me.