"Rails s" or "Rails c" in the console fails: "It looks like your application. / Bin / rails is a stub created by the Bundler"

Here is the conclusion. What happens next?

Using Rails 3.x. I tried "gem cleaning" and then "install the package" without effect.

Has anyone come across this?

Looks like your app ./bin/rails is a stub that was generated by Bundler. In Rails 4, your app bin/ directory contains executables that are versioned like any other source code, rather than stubs that are generated on demand. Here how to upgrade: bundle config --delete bin # Turn off Bundler stub generator rake rails:update:bin # Use the new Rails 4 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 WARN: Unresolved specs during Gem::Specification.reset: minitest (~> 4.2) rake (>= 0.8.7) WARN: Clearing out unresolved specs. Please report a bug if this causes problems. /Users/Will/.rvm/gems/ ruby-2.0.0-p481@global /gems/bundler-1.6.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated activesupport 4.0.8, but your Gemfile requires activesupport 3.2.16. Prepending `bundle exec` to your command may solve this. (Gem::LoadError) from /Users/Will/.rvm/gems/ ruby-2.0.0-p481@global /gems/bundler-1.6.2/lib/bundler/runtime.rb:19:in `setup' from /Users/Will/.rvm/gems/ ruby-2.0.0-p481@global /gems/bundler-1.6.2/lib/bundler.rb:120:in `setup' from /Users/Will/.rvm/gems/ ruby-2.0.0-p481@global /gems/bundler-1.6.2/lib/bundler/setup.rb:7:in `<top (required)>' from /Users/Will/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require' from /Users/Will/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require' from /Users/Will/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require' from /Users/Will/Projects/explovia/config/boot.rb:6:in `<top (required)>' from /Users/Will/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require' from /Users/Will/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require' from /Users/Will/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.8/lib/rails/app_rails_loader.rb:42:in `block in exec_app_rails' from /Users/Will/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.8/lib/rails/app_rails_loader.rb:32:in `loop' from /Users/Will/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.8/lib/rails/app_rails_loader.rb:32:in `exec_app_rails' from /Users/Will/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.8/lib/rails/cli.rb:6:in `<top (required)>' from /Users/Will/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:69:in `require' from /Users/Will/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:69:in `require' from /Users/Will/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.0.8/bin/rails:9:in `<top (required)>' from /Users/Will/.rvm/gems/ruby-2.0.0-p481/bin/rails:23:in `load' from /Users/Will/.rvm/gems/ruby-2.0.0-p481/bin/rails:23:in `<main>' 
+5
source share
2 answers

Did you try to run commands through the bundle? The error log states:

 You have already activated activesupport 4.0.8, but your Gemfile requires activesupport 3.2.16. Prepending `bundle exec` to your command may solve this. (Gem::LoadError) 

So try running like this:

 > bundle exec rails c > bundle exec rails s 
+2
source

As a monkey working on a computer, I followed the instructions displayed by the rails, and for me it worked like a divine miracle:

 bundle config --delete bin # Turn off Bundler stub generator rake rails:update:bin # Use the new Rails 4 executables git add bin # Add bin/ to source control 

I hope this works for everyone who is trying to do this in the future. (of course, you will need to remove comments that are words after and including the # character)

+7
source

Source: https://habr.com/ru/post/1204242/


All Articles