What steps did you take to create this error?
I launch the RStudio and it showed this
So a caveat that this is really outside of my base of knowledge, but I'll see what I can do. From looking at this and this, it looks like the R_TempDir
variable is a global C variable, and it's also used by the tempdir()
and tempfile()
R functions. So that seems like maybe it's a permissions issue?
I also just found this issue:
Are you able to launch RGUI? If so, can you run this snippet? cat("Hello tempdir!", file = tempfile(fileext = ".txt"))
I can t run RGui and what is snippet
The snippet tries to write a temp file, but if you can't launch R at all, then you wouldn't be able to run it.
Can you run this from powershell or CMD? "C:\Program Files\R\R-4.0.2\bin\Rscript.exe" -e "tempdir()"
You would need to sub in your own location of Rscript.exe.
And then do you have write permissions on a folder that looks like this? C:\Users\ethan\AppData\Local\Temp
I apologize, the way I wrote that was unclear! The outside quotes are important to include in this case. So what you enter into PS should be this, including all quotes: "C:\Program Files\R\R-4.1.0\bin\Rscript.exe" -e "tempdir()"
Were you able to check if you have access to C:\Users\{your-user-name}\AppData\Local\Temp
?
how to check this access
I apologize for not explaining that. Can you navigate to that folder path in file explorer? If so, can you create a new file of any kind in that folder?
Yep I can create new folder in Temp
Well, that's bothersome. What's your output of this in PowerShell?
gci env: | Where-Object { $_.Name -like 'T*MP' }
Thanks! That TEMP
variable looks like a bad path (No slash after the C:). Could you run this in PS and try launching RStudio again?
$env:TEMP = $env:TMP
This will set both variables to the value of TMP
, which looks more like a working path.
the same as fatal error
Okay, could you try restarting, run gci env: | Where-Object { $_.Name -like 'T*MP' }
to verify that TEMP and TMP are the same, and then launch R? I'll try to think what else might be going on in the meantime.
Okay, I did find this thread, which suggests it may be related to insufficient memory:
So you could try setting your TMPDIR variable to something new, like ~/Documents/Temp
and then maybe it would work?
how to do it create new variable?
First, create the directory you want to use, for example ~/Documents/Temp
. Then run $env:TMPDIR = "~/Documents/Temp"
. After that, try running R (You may need to restart your machine first)