Closed
Description
Let's say hypothetically, I was away at a conference for a week, and get back on Monday to pull the latest changes and start work. I've found that running rails server
, or really any subcommand (I was trying rails db:drop
), you end up getting a stacktrace because some gems couldn't be found:
❯ bin/rails db:drop
You're missing some gems. Run `bundle install` to fix it.
Traceback (most recent call last):
21: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/spring-4.0.0/bin/spring:49:in `<main>'
20: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/spring-4.0.0/lib/spring/client.rb:30:in `run'
19: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/spring-4.0.0/lib/spring/client/command.rb:7:in `call'
18: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/spring-4.0.0/lib/spring/client/server.rb:9:in `call'
17: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
16: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
15: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/spring-4.0.0/lib/spring/server.rb:9:in `<top (required)>'
14: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
13: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
12: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/spring-4.0.0/lib/spring/commands.rb:4:in `<top (required)>'
11: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/spring-4.0.0/lib/spring/commands.rb:33:in `<module:Spring>'
10: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
9: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
8: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
7: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
6: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
5: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
4: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler.rb:151:in `setup'
3: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:18:in `setup'
2: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:239:in `specs_for'
1: from /Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:191:in `specs'
/Users/josh.nichols/.asdf/installs/ruby/2.7.5/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:486:in `materialize': Could not find aws-partitions-1.588.0, vite_ruby-3.1.1 in any of the sources (Bundler::GemNotFound)
bin/rails
is the generated binstub for spring:
#!/usr/bin/env ruby
load File.expand_path("spring", __dir__)
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative "../config/boot"
require "rails/commands"
That would make sense it load spring, and try to start a server. The place it falls down is here:
Lines 31 to 33 in 184ecda
Finding that, I saw that ~/.spring.rb
is loaded. I was able to add this to that file and get better error:
❯ cat ~/.spring.rb
begin
require "bundler/setup"
rescue Bundler::GemNotFound
$stderr.puts "Missing gems from your Gemfile. Trying running `bundle install` to fix!"
exit 1
end
❯ rails runner "puts 'hi'"
Missing gems from your Gemfile. Trying running `bundle install` to fix!
Interestingly, bin/spring server
shows a colorful error with the info you need:
❯ bin/spring server
Could not find aws-partitions-1.588.0, vite_ruby-3.1.1 in any of the sources
Run `bundle install` to install missing gems.
Metadata
Metadata
Assignees
Labels
No labels