Issues installing FactoMineR and devtools packages

Hello,
I am trying to use the packages from this tutorial https://www.datacamp.com/tutorial/pca-analysis-r
I am having issues installing FactoMineR. After I install and try to load it I get the following message:

library("FactoMineR")
Error: package or namespace load failed for ‘FactoMineR’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘emmeans’

Similarly, with devtools package. After I install it and try to load it, I get the following message:

library(devtools)
Error: package or namespace load failed for ‘devtools’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘shiny’

I have tried closing R, and loading the packages ‘emmeans’ and ‘shiny’ before re-loading the packages, but I still get the following messages:

library("emmeans")
Error: unexpected '>' in ">"

library("shiny")
library(devtools)
Error: package or namespace load failed for ‘devtools’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘htmltools’ 0.5.4 is already loaded, but >= 0.5.7 is required