Search code examples
ruby-on-railsrubyrubygemsrbenv

When making a new Rails app, I get the following error: `require': cannot load such file -- bundler (LoadError)


I've seen a couple other similar questions, but no solutions. When I create my new Rails app, I receive the following error:

/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in 'require': cannot load such file -- bundler (LoadError)

Tried gem install bundler && bundler install and I get:

Successfully installed bundler-1.10.6 Parsing documentation for bundler-1.10.6 Done installing documentation for bundler after 6 seconds 1 gem installed Could not locate Gemfile or .bundle/ directory

The app is still created and works, but I don't know why I'm getting the error. Please let me know if you need more specific information to provide an answer. This is my first post to stackoverflow, so I'm still learning. Thanks!


Solution

  • I was running into the same problem today.

    I was running ruby 2.2.1 (via rbenv) and rails 4.2.1.

    In the end I installed ruby 2.2.2 (via rbenv). I then installed rails 4.2.5. rails new then worked without problem.

    So I don't know what the underlying problem is, but maybe this will be helpful to someone.