Been scratching my heads for hours over this.
All of a sudden I am unable to run the commands bundle update and bundle install on my projects.
I receive the following errors:
There was an error while trying to write to
C:/Users/REMOTE~1/AppData/Local/Temp/bundler-compact-index-20181216-9268-sd4t9f/versions
. It is likely that you need to grant write permissions for that path.
1.) That path and user do not exist
2.) I have looked at env variables and they all point to my user
3.) This has nothing to do with my project as even if I try to create a new rails project, part of the rails new command runs 'bundle install' and so that fails too.
4.) I am an administrator so I don't understand why I wouldn't have full read/write access.
Extra Information:
Bundler Env:
## Environment
```
Bundler 1.17.2
Platforms ruby, x86-mingw32
Ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
Full Path C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe
Config Dir C:/ProgramData
RubyGems 2.5.2
Gem Home C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0
Gem Path C:/Users/correctuser/.gem/ruby/2.3.0;C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0
User Path C:/Users/correctuser/.gem/ruby/2.3.0
Bin Dir C:/RailsInstaller/Ruby2.3.3/bin
Tools
Git 2.19.1.windows.1
RVM not installed
rbenv not installed
chruby not installed
```
## Bundler Build Metadata
```
Built At 2018-12-11
Git SHA 43e950846
Released Version true
```
Gem Environment:
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: C:/Users/correctuser/.gem/ruby/2.3.0
- RUBY EXECUTABLE: C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/RailsInstaller/Ruby2.3.3/bin
- SPEC CACHE DIRECTORY: C:/Users/correctuser/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0
- C:/Users/correctuser/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- C:\Program Files\ConEmu\ConEmu\Scripts
- C:\Program Files\ConEmu
- C:\Program Files\ConEmu\ConEmu
- C:\Program Files (x86)\Common Files\Oracle\Java\javapath
- C:\windows\system32
- C:\windows
- C:\windows\System32\Wbem
- C:\windows\System32\WindowsPowerShell\v1.0\
- C:\windows\System32\OpenSSH\
- C:\Program Files\Git\cmd
- C:\Program Files\PuTTY\
- C:\Program Files\nodejs\
- C:\Program Files (x86)\QuickTime\QTSystem\
- C:\RailsInstaller\Git\cmd
- C:\RailsInstaller\Ruby2.3.3\bin
- C:\Users\correctuser\AppData\Local\Microsoft\WindowsApps
- C:\Users\correctuser\AppData\Roaming\npm
- C:\Program Files\heroku\bin
- C:\Program Files\JetBrains\RubyMine 2018.3\bin
After 3 days of tinkering and trying to find a solution I came up with the following.
1.) As @anothermh mentioned, it is probably best to install Ruby on Windows Subsystem for Linux Installing Ruby on WSL (Windows Subsystem for Linux) to avoid these kind of situations.
2.) For people who still want to continue using Ruby on their windows systems.
This error occurs when your bundler rubygems copy is corrupted and gets cached into your system.
I solved this by deleted the folder .bundle in C:/users/my_user/.bundle
Re-install bundler and this error goes away and your gems compile and install as usual.