also this message can happen when R does not load the default packages by default, among which utils.
Usually this happens if you have options(defaultPackages = character())
or R_DEFAULT_PACKAGES=NULL
set somewhere in your environment.
Example with Powershell
> $env:R_DEFAULT_PACKAGES=$null
> Rscript --vanilla -e "packageVersion('rmarkdown')"
[1] '2.16.1'
> $env:R_DEFAULT_PACKAGES="NULL"
> Rscript --vanilla -e "packageVersion('rmarkdown')"
Erreur dans packageVersion("rmarkdown") :
impossible de trouver la fonction "packageVersion"
Exécution arrêtée
We'll improve that on our side, but still a specific use case.
Do you have one of those configuration set by any chance ?
I have added an issue for this anyway: Correctly namespace usage of R default package functions like utils · Issue #2187 · quarto-dev/quarto-cli · GitHub