0

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 
NemyaNation
  • 983
  • 1
  • 12
  • 22
  • 1
    This does not answer your question but I would never recommend trying to run Ruby directly on Windows. Even though it can be done, it has tons of edge case issues like this and a much smaller user base that can answer questions about it. If you want to use Ruby on Windows I would recommend using [WSL](https://stackoverflow.com/q/37405528/3784008) rather than using it directly on Windows. – anothermh Dec 16 '18 at 20:45
  • @anothermh I realise that, but I've been developing on windows system for 3 years now and using Ruby. I've never come across this problem. If I still can't find a solution I will have to find alternative ways to run ruby. – NemyaNation Dec 16 '18 at 20:49
  • 1
    If it helps, on POSIX systems you would typically use a manager of some kind to install Ruby, like [RVM](https://rvm.io), and it's always safe to completely remove all installed Rubies and gems and RVM itself (`rm -rf ~/.rvm`) when problems crop up and then reinstall RVM, then Ruby, then `bundle install` again. Not sure how it's installed on Windows, but perhaps you can do something similar. – anothermh Dec 16 '18 at 21:01
  • @anothermh I've been looking into installing WSL and using a package manager such as RVM. Thanks for the links and tips. – NemyaNation Dec 24 '18 at 17:17

1 Answers1

0

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.

NemyaNation
  • 983
  • 1
  • 12
  • 22