Are you working on a network drive? Or do you have software that would be indexing or backing up your development directory semi-continuously? I believe I've seen that issue in both of those cases.
Short of putting it on a local drive without backups , I don't actually have a solution, though.
Edit: Just noticed the title of this thread. It's definitely the sync program that is causing the problem, and I haven't figured out a solution other than pausing it (at least when I ran into it with Dropbox).
From what I understand, this is typically caused by RStudio and Google Drive (or other auto-synchronizing cloud storage providers) competing for access on files written by RStudio. Typically, these are the session-specific files written by RStudio into the (hidden) .Rproj.user folder, located in the project directory.
I get that message frequently when working with RStudio on a Windows. It can be very annoying! When I run into this issue, I just pause my Google Drive sync. You can follow the instructions here: https://productforums.google.com/forum/#!topic/drive/R8GuAY_g9so to the learn how to pause the sync.
Once you are done, you can resume the sync to make sure your files are still backed up.
Another option is to use insync (https://www.insynchq.com/) to sync your Google drive. Yes, you have to pay, but I started using the service almost a year and a half ago specifically because I replaced my Linux box with a Windows machine and started receiving these messages in RStudio. Everything was fine until I had to reinstall Windows last week and decide to give the native Drive Backup and Sync application a try. Messages are back, so I will be reinstalling insync tomorrow.
To add here I was having related problems syncing project folders over Google File Stream on my GSuite account. This was mainly due to RStudio and git competing for resources with GFS as kevinushey suggests above. Thanks Kevin!
What I did to fix:
Set the R Studio project folder to be available for offline access in Google File Stream. Without this R Studio did not know how to open files.
Set .Rproj.user to be online only.
Set .git to be online only.
No more problems, R Studio runs beautifully and my data, scripts, and outputs are synced to my GSuite account as I work!
I am new to all of this. Could you describe where these options would be located in each program? I bounce between a desktop and laptop and run into this issue CONSTANTLY.
Thanks in advance!
I couldn't get Google Backup & Sync to properly ignore the .Rproj.user folder or affected subfolders using its selective sync feature without it deleting required files or creating duplicate files that would cause the issue to persist. However, I did manage to solve the issue using symbolic links in Windows.
Steps:
Close RStudio project
Move .Rproj.user folder outside of Google Drive folder
Create a symbolic link in the working directory using the following command in command prompt:
mklink /d “C:\Users\Username\Google Drive\Project\.Rproj.user” “C:\Project\.Rproj.user”
Right click symbolic link and select Properties > General > Hidden
If done correctly, RStudio will still be able to read/write from the .Rproj.user folder as if it were actually in the working directory, but Google Backup & Sync will completely ignore it while syncing all other files in the working directory.