rstudio怎么打开保存的文件_在RStudio中生成并重新加载会生成“保存文件”错误...

I'm working on an Rcpp-enabled R package as a project in RStudio (version 1.0.136, Ubuntu 16.04 64 bit), and have recently started getting an error after building the package with Tools > Build and Reload. The error dialogue box reads:

Save File

No such file or directory

The error doesn't appear straight after building and reloading. Rather, it occurs some time later while making edits to files, seemingly at random, and not necessarily while trying to save. However, after closing the dialogue box files cannot be saved without generating another error, this time with the message:

Error Saving File

No such file or directory

Following that, the only way forward is to restart RStudio without saving any files, thus losing all changes.

It doesn't seem to be a problem with either roxygen2 or devtools since I've tried building with and without the Generate documentation with Roxygen and Use devtools package functions options in Tools > Project Options > Build Tools. I've also tried uninstalling andreinstalling RStudio as well as updating devtools etc, but the problem persists. I'm wondering if it's an issue in one of the package files such as NAMESPACE or DESCRIPTION. The package repository is available at https://github.com/shaunpwilkinson/insect.

解决方案

I ran into this error myself, and I'm posting what seems to have worked based on the comment from Shaun and a post on the RStudio support website.

The error is not limited to building a package; I encountered it while working in a bog standard RStudio project.

I found this comment from RStudio support here:

I think that if you clear the sdb (source data based) directory inside ~/.rstudio, then this might get things working for now.

So I closed RStudio, went into the terminal and removed the entire subdirectory .RStudio.user (inside the project directory, which is not what the comment above suggested directly). I restarted RStudio and voila. It works, and RStudio recreated the .RStudio.user directory.

WARNING: this will delete all the unsaved data including the contents of your environment and any unsaved files. You should copy the contents of unsaved files to another text editor before using this fix.

For future reference I am using RStudio 1.0.143 on OS/X 10.12.5.

你可能感兴趣的:(rstudio怎么打开保存的文件_在RStudio中生成并重新加载会生成“保存文件”错误...)