Reputation: 495
I'm learning Rails with tutorials from Ruby on Rails by Michael Hartl: https://www.railstutorial.org/book
I used the following command to generate a controller:
rails generate controller StaticPages home help
Which generates the following error regarding version conflicts:
check_version_conflict': can't activate bundler-1.12.4, already
activated bundler-1.13.0.pre.1 (Gem::LoadError)
I don't know which bundler version to use. The current version of bundler is: 1.13.pre.1
The following command continued failing due to about five gem dependencies that failed to install automatically, which included listen
and nokigiri
.
bundle install --without production
I tried installing the dependent gems manually, but I'm still having issues.
How do I resolve the check_version_conflict
issue with Bundler
when generating Rails controllers?
I'll accept an answer that instructs removing current Ruby libs and installing a new development environment from scratch.
Upvotes: 1
Views: 270
Reputation: 3396
Ten steps to resolve your issues with Bundler
rbenv
to install Ruby. Follow instructions here: https://github.com/rbenv/rbenvFrom the command line:
mkdir repo
cd repo
From the command line:
gem install bundler
bundle init
repo/Gemfile
with your editor, and configure it to instruct Bundler which version of Rails to installIn repo/Gemfile
:
source "https://rubygems.org"
gem "rails", "4.2.6"
From the command line:
bundle install
cd
into itFrom the command line:
bundle exec rails new whatevs
cd whatevs
In repo/whatevs/Gemfile
:
gem 'nokogiri', '1.6.8'
repo/whatevs/
directory, install your app's Gems via BundlerFrom the command line:
bundle install
repo/whatevs/
directory, generate a controllerFrom the command line:
bundle exec rails generate controller static_pages home help
Upvotes: 1
Reputation: 26768
Bundler will install project-specific versions of your gems so that you don't have to manage global dependencies.
In effect, if you install Rails with bundler and you also install it with sudo gem install rails
or something like that, you'll have two versions on your computer. By default, calling rails
will refer to the global version.
If you call bundle exec rails
(or bundle exec <gem_name>
), it will call the bundler-specific version.
Upvotes: 2