I recently cloned a previous project I was working on to a new computer. I was using RVM
but switched over to rbenv
on my new computer. Whenever I run any rails
command I am getting this error. Not really sure how to fix this as I am learning rails/ruby at the moment
Beginning in Rails 4, Rails ships with a `rails` binstub at ./bin/rails that
should be used instead of the Bundler-generated `rails` binstub.
If you are seeing this message, your binstub at ./bin/rails was generated by
Bundler instead of Rails.
You might need to regenerate your `rails` binstub locally and add it to source
control:
rails app:update:bin # Bear in mind this generates other binstubs
# too that you may or may not want (like yarn)
If you already have Rails binstubs in source control, you might be
inadvertently overwriting them during deployment by using bundle install
with the --binstubs option.
If your application was created prior to Rails 4, here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
Traceback (most recent call last):
4: from /Users/liondancer/.rbenv/versions/2.7.1/bin/rails:23:in `<main>'
3: from /Users/liondancer/.rbenv/versions/2.7.1/bin/rails:23:in `load'
2: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.1/exe/rails:10:in `<top (required)>'
1: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- rails/cli (LoadError)
7: from /Users/liondancer/.rbenv/versions/2.7.1/bin/rails:23:in `<main>'
6: from /Users/liondancer/.rbenv/versions/2.7.1/bin/rails:23:in `load'
5: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.1/exe/rails:10:in `<top (required)>'
4: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:156:in `require'
3: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:161:in `rescue in require'
2: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems.rb:211:in `try_activate'
1: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1365:in `activate'
/Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:2237:in `check_version_conflict': can't activate railties-6.0.2.2, already activated railties-6.0.3.1 (Gem::LoadError)
8: from /Users/liondancer/.rbenv/versions/2.7.1/bin/rails:23:in `<main>'
7: from /Users/liondancer/.rbenv/versions/2.7.1/bin/rails:23:in `load'
6: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.1/exe/rails:10:in `<top (required)>'
5: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:156:in `require'
4: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:161:in `rescue in require'
3: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems.rb:210:in `try_activate'
2: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems.rb:217:in `rescue in try_activate'
1: from /Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1365:in `activate'
/Users/liondancer/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:2237:in `check_version_conflict': can't activate railties-6.0.2.2, already activated railties-6.0.3.1 (Gem::LoadError)
The solution is right there:
rails app:update:bin