why can't Bundle exec can't find installed gems in 'vendor/bundle'

62 Views Asked by At

I'm trying to execute a rails project (via bundle exec puma -C config/puma.rb) and I'm getting "Can't find GEM NAME" errors. What's strange is that this is only a recent issue after a DB upgrade caused by an upgrade of the image the VM uses for running the app.

Whilst the image has been upgraded, none of the things directly related to the app itself (besides the DB upgrade) have actually changed, we're still currently using the same Ruby, same gems and version and same method of building the RPM (via FPM).

the .bundle/config is:

---
BUNDLE_FROZEN: "true"
BUNDLE_PATH: "vendor/bundle"

and it's definitely being picked up by bundler as bundle env clearly shows:

## Bundler settings

\```
frozen
  Set for your local app (/var/app_name/current/.bundle/config): true
path
  Set for your local app (/var/app_name/current/.bundle/config): "vendor/bundle"
\```

the specific error I get is:

bundler: failed to load command: puma (/var/app_name/current/vendor/bundle/ruby/2.5.0/bin/puma)
Bundler::GemNotFound: Could not find rake-12.3.3 in any of the sources

but If I look in vendor/bundle/ruby/2.5.0/gems I can clearly see rake & that it's the correct version.

I have noticed the gem path doesn't seem to include the vendor path:

## Environment

\```
Bundler       1.16.1
  Platforms   ruby, x86_64-linux
Ruby          2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
  Full Path   /usr/bin/ruby
  Config Dir  /etc
RubyGems      2.7.6.3
  Gem Home    /usr/share/gems
  Gem Path    /var/app_name/.gem/ruby:/usr/share/gems:/usr/local/share/gems
  User Path   /var/app_name/.gem/ruby
  Bin Dir     /usr/bin
Tools
  Git         not installed
  RVM         not installed
  rbenv       not installed
  chruby      not installed
\```

I've tried changing that with bundle config set --local path vendor/bundle or by doing BUNDLE_PATH="vendor/bundle" bundle env but see no difference in the Gem path.

I'm not sure what else to do to fix this as I've honestly never encountered this specific issue before of "bundler seemingly ignoring the vendor gems" so I'm kind of stuck

P.S. I know the ruby version is a bit old, I'll get around to upgrading at some point...

0

There are 0 best solutions below