简体   繁体   中英

After Running `gem update --system` Bundler packaging gems to vendor/cache/ruby/<version>

When trying to figure out a bundling issue on TravisCI I accidentally ran

gem update --system

on my Mac. This updated a bunch of things, but I don't know exactly what since I did not save the output. After doing this, in my Rails application, I noticed that when I ran bundle install --local it began installing and packaging the gems into vendor/cache/ruby/<version> instead of using the ones in vendor/cache .

The path in bundler is set to vendor/cache but some other setting is causing it to bundle the gems under the ruby version directory. Does anyone know what that setting might be or how I can fix Bundler so it uses the gems in vendor/cache ?

Gem versions

bundler - 2.1.2 (2019-12-20 commit 4da3289eb)
rubygems - 3.1.2

Bundler Config

$ bundle config
Settings are listed in order of priority. The top value will be used.
build.libv8
Set for the current user (/Users/me/.bundle/config): "--with-system-v8"

cache_all
Set for your local app (/Users/me/forem/.bundle/config): true
Set for the current user (/Users/me/.bundle/config): true

jobs
Set for the current user (/Users/me/.bundle/config): 3

path
Set for the current user (/Users/me/.bundle/config): "vendor/cache"

Let me know if any other information would be helpful!

Ok folks here is what the issue was.

Bundler Explained

Bundler has 2 settings

  1. path (BUNDLE_PATH) - The location on disk where all gems in your bundle will be located regardless of $GEM_HOME or $GEM_PATH values. Bundle gems not found in this location will be installed by bundle install. Defaults to Gem.dir. When --deployment is used, defaults to vendor/bundle.
  2. cache_path (BUNDLE_CACHE_PATH) - The directory that bundler will place cached gems in when running

The Problem

I set BUNDLE_PATH to "vendor/cache". This caused Bundler to try and install all of the gems in "vendor/cache/ruby//" which is not ignored by .gitignore and therefore causes a massive dif.

Solution:

Reset BUNDLE_PATH back to its default "vendor/bundle"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM