Unable to load shared object on startup in RStudio only

I'm not sure what I did, and my IS team is stumped. I updated R from 3.5.2 to 3.6.0 and R throws this error when opened in RStudio There is no problem when running R in the gui.

Error: package or namespace load failed for ‘stats’ in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Program Files/R/R-3.6.0/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

I can navigate to the stats.dll file and the dll file matches my .libPaths():
"C:/Program Files/R/R-3.6.0/library"

I have uninstalled and reinstalled both R and RStudio (1.2.1335). I have also restarted my computer. Any help or even temporary solutions would be appreciated.

After updating R, have you updated your packages with checkBuilt?

update.packages(checkBuilt=TRUE)

Have you copied the content of your old library folder overwriting the content already present in the new one?

Thanks for responding. We uninstalled R and deleted everything before reinstalling it so there was no library folder to overwrite. The code you submitted kicked off a few updates but the error is still present.

On occasion, library load errors can be due to a PATH environment variable set such that other libraries are not found in the location they're expected to be found.

What is the output of:

Sys.getenv("PATH")
Sys.which("stats.dll")

(Just in case stats.dll is on the PATH for some reason, provided by a different application)

You totally nailed it! I had a typo in one of my PATH variables. Thank you for your help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.