I've been using R Studio for years now, but quite literally the same happened. Tried to install plotly for some homework I had, it wouldn't allow me. The error message being showed was:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 0.4.5 is being loaded, but >= 0.4.10 is required
ERROR: lazy loading failed for package ‘lifecycle’
Macos has its distinct peculiarities in R. I recommend searching for a guide to R that covers installing Xcode, which is an macos requirement when compiling binaries from source.
On MacOS, to install from source, you need to both INSTALL the then-current version of Apple's XCode AND to run it to install the command line tools.
Without the command line tools installed on first run, XCode can't run gcc etc. when R tries to compile. That's likely where your "non-zero exit" is coming from.
You (may) need to re-do this after all XCode installations and updates.