there is no package called 'X'

The package is installed somewhere, but not in the library this R session uses

why

R keeps separate libraries per version and per install, so a package installed under R 4.3 is invisible to R 4.4, and one installed in a conda environment is invisible outside it. In a workflow, the R that runs the task is often not the R you tested in.

what to do

Ask the running session where it is looking: .libPaths() and sessionInfo(), printed from inside the failing script rather than from your console. Install into that library, and keep Bioconductor packages installed through BiocManager so their versions stay matched to your R version.

R library path behaviour
This is one entry from BioErrors, a catalogue of bioinformatics error messages that point at the wrong thing. Every entry was traced to its real cause before it was written down.
If your error is not in it, paste it there and it gets traced and added.