Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Rails s" or "Rails c" in console fails: "Looks like your app's ./bin/rails is a stub that was generated by Bundler"

Here's the output. What on earth is going on?

Using Rails 3.x. I've tried "gem cleanup" followed by "bundle install" to no effect.

Has anyone encountered this?

Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

  bundle config --delete bin    # Turn off Bundler's 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>'
like image 368
Will Taylor Avatar asked Oct 08 '14 09:10

Will Taylor


2 Answers

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

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

I hope it works for everyone who's trying it in the future. (of course you would need to remove the comments - which are the words after and including the # symbol)

like image 55
BenKoshy Avatar answered Oct 14 '22 05:10

BenKoshy


Have you tried running the commands through 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 so:

> bundle exec rails c
> bundle exec rails s 
like image 29
Matt Avatar answered Oct 14 '22 05:10

Matt