IRanges is not in CRAN, you have to install it from Bioconductor
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("IRanges")
If you get an error message while doing this, please post the complete console output you get.
Since you are using an old R version you might need to use an older Bioconductor release as well
BiocManager::install("IRanges", version = "3.15")