package stats was not found

I am experiencing a persistent error when starting RStudio with R version 4.5.1 on Windows 11 (build 22631.5472). The error is:

package ‘stats’ in options("defaultPackages") was not found
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/R/R-4.5.1/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.

What I’ve done so far:

Completely uninstalled and reinstalled:

    R 4.5.1 (base version, working fine standalone)

    RStudio (latest version 2025.05.1+513)

    RTools 4.5

Verified that stats.dll exists at the specified path.

Reset all user-level RStudio configurations under %LOCALAPPDATA%\RStudio.

Tried safe mode and --vanilla start — error persists.

R itself starts and runs without issue in the standalone console. Only RStudio fails to load the stats package at startup.

Could you help identify what might be causing RStudio to fail at loading a present DLL?

Thanks!

Make sure that RStudio is configured to use the correct R installation, if you happen to have multiple versions installed.

Also check that you don't have some antivirus program disabling RStudio from loading DLLs, or a similar restriction.