Prompt to install missing R packages doesn't appear in RStudio 2024

Hello everyone!

I installed the latest version of RStudio (2024) and R (4.4.1) in my windows 11 machine.
I already activated debug options to show packages required by my script
But even when I dont have a package, i still dont get the prompt to install those.
I also tried saving, opening and reopening any script that contains library(not-installed-package), but the message never shows.

For the example in your screenshot, it won't provide the "Package dplyr required but not installed" message at the top of the editor pane unless the file has been saved.

For the files you mention you have saved and require packages that aren't installed, do you get TRUE for both of these, replacing dplyr with the package in question:

!"dplyr" %in% rownames(installed.packages())
"dplyr" %in% rownames(available.packages())

I also tried saving the file as per other questions.
I'm sure no package is installed because that was a fresh R install!
I'm testing again with a package that I know is not installed:


> library(pacotest)
Error in library(pacotest) : there is no package called ‘pacotest’
> !"pacotest" %in% rownames(installed.packages())
[1] TRUE
> "pacotest" %in% rownames(available.packages())
[1] TRUE

Still, no "auto-install" on saved or unsaved scripts, even when restarting R studio or reloading the script.
The "show diagnostics" also does not show anything related to installs.
This is the last version of R (4.4.1 - 2024-06-14) and RStudio (2024.04.2 build 764) on an updated windows 11 machine
This seems to be an unstable bug as I just tried in another windows 11 machine, with the same versions, and for that machine the auto-install did work! But not for my work notebook

UPDATE: I modified a new R script, saved, with no luck on the auto install prompt. Closed and reopened R studio, no change. But I remodified the script by adding a simple command, exited R studio, which prompted me to resave the script. When I finally closed R studio, saved that script with the prompt, and reopened it, the auto install prompt started working with all my scripts. This seems to really be a bug but I'm not sure if it will be easy to reproduce.

To Run a particular library in R, the first requirement is to install that library if it has not installed then your code will definetely show you this error, try the following code

`Install.packages(dplyr)`

What was the command? Did it use a method from the package that was now prompted?

It could well be a bug, but details might help a Posit employee diagnose the issue.