Reputation: 65
I'm running OS X, 10.11.2 (15C50), with rvm 1.26.11, ruby 2.3.0p0 and gem 2.5.1.
If I try to run rails g controller welcome
or any other generate command, I get the following error.
I've done a rvm implode, installed ruby, rails, bundler from scratch. Created a new app, the problem remains.
% rails g controller welcome
/Users/username/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/username/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:33:in `<module:Spring>'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:4:in `<top (required)>'
from /Users/username/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:77:in `preload'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:143:in `serve'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:131:in `block in run'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `loop'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `run'
from /Users/username/Projects/tweener-frontend/vendor/bundle/gems/spring-1.6.1/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/username/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/username/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Upvotes: 2
Views: 3608
Reputation: 65
So bundle exec rails s
seems to be the fix.
I guess I need to understand why I need to use bundle exec instead of just rails s
. Time to read the manual :)
Thanks everyone
Upvotes: 0
Reputation: 3207
I had the same issue and I did the following to fix the issue:
bundle install --binstubs
Try this first and then try running:
bundle exec rails g controller welcome
Hope it helps.
Upvotes: 4