Cannot import libraries

Although I use install.packages() to install the necessary libraries I need (dplyr and lubridate), when I try to import them with the command library("packageName"), I keep getting this error message:

library(dplyr)
Error in library(dplyr) : there is no package called ‘dplyr’

How can I avoid this error?

What output do you get when calling install.packages("dplyr")? Any error messages?