I'm running latest stable version of windows 10. Just uninstalled and then reinstalled R, RTools and RStudio Desktop. Tried again and got the same error.
By the way, the Rprofile.site file that came with the R I installed from CRAN (R-4.1.2) has the following commented out line as a suggestion for changing the library location:
set a site library
#.Library.site <- file.path(chartr("\", "/", R.home()), "site-library")
I tried commenting out the .Library.site line, and restarting R, but that didn't actually work!
But your code from your blog post (using .Libpaths) did!
Because of the way you have configured your Windows account, R.home() evaluates to the same OneDrive folder you have seen before so you haven't been making any actual change.