Rstudio build tools not finding installed packages

When I am in a project which is a package, and run Build / Build Source Package, I see the following error message in the Build window:

==> devtools::document(roclets=c('vignette'))
Error in loadNamespace(name) : there is no package called 'devtools'
Calls: suppressPackageStartupMessages ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
Exited with status 1.

but if I run the same code


in the console, it runs without a problem. Therefore, it appears that the Rstudio build tool is looking for the package in some other location. When I look in the Help window under packages, the package location is given as
Packages in C:\Users\ [my user name] \Documents\R\win-library\3.5.0 and loading it by checking its box in the Packages window works fine.

If my guess is correct that Rstudio is not finding the package where it expects to, how can I tell it where to look, or, failing that, where should I install packages that will allow Rstudio's build tools to find them?
If this is not the problem, what else might it be?
On a related note, I see that the leftmost button in the menu bar of the Build window is shown in documentation on the website as Build and Install, while on my screen it appears as Install and Restart. Is this an option that can be changed?