Reputation: 21
I am trying to make new ruby on rails
project with:
rails new . --no-ri --no-rdoc
But at the end of execution of this command I got:
run bundle install
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.2.6) was resolved to 4.2.6, which depends on
bundler (< 2.0, >= 1.3.0)
Current Bundler version:
bundler (2.2.27)
Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with `gem install bundler:2.0.0.pre.3` and rerun bundler using `bundle _2.0.0.pre.3_ install`
Fetching gem metadata from https://rubygems.org/.............
Resolving dependencies...
run bundle exec spring binstub --all
Traceback (most recent call last):
13: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
12: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
11: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/setup.rb:20:in `<top (required)>'
10: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/ui/shell.rb:88:in `silence'
9: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/ui/shell.rb:136:in `with_level'
8: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/setup.rb:20:in `block in <top (required)>'
7: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler.rb:149:in `setup'
6: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/runtime.rb:18:in `setup'
5: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/definition.rb:234:in `specs_for'
4: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/definition.rb:483:in `materialize'
3: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/definition.rb:262:in `resolve'
2: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/resolver.rb:23:in `resolve'
1: from /var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/resolver.rb:46:in `start'
/var/lib/gems/2.5.0/gems/bundler-2.2.27/lib/bundler/resolver.rb:59:in `rescue in start': Bundler could not find compatible versions for gem "bundler": (Bundler::VersionConflict)
In Gemfile:
rails (= 4.2.6) was resolved to 4.2.6, which depends on
bundler (< 2.0, >= 1.3.0)
Current Bundler version:
bundler (2.2.27)
Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with `gem install bundler:1.11.2` and rerun bundler using `spring _1.11.2_ binstub --all`
After that I removed ruby, so that with commands ruby -v
I got:
bash: /home/iva/.rbenv/shims/ruby: No such file or directory
Then I installed again ruby and installed gem with gem install bundler:1.11.2
. But after this installation with checking versions of ruby and gem I got:
ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
gem -v
2.7.6
I don't know how is this 2.7.6
version of gem when I gave command with version 1.11.2
?
So it seems like some circle, and I don`t know how to get out of it. I am installing ruby, it requires older version of gem, but with any command newest version of gem is always installing at my computer. What should I do in this situation?
============================================================= Response for this commands are:
rbenv versions
* 2.5.1 (set by /home/iva/.rbenv/version)
echo $PATH
/home/iva/.rbenv/shims:/home/iva/.rbenv/bin:/home/iva/.rbenv/shims:/home/iva/.rbenv/bin:/home/iva/.rbenv/shims:/home/iva/.rbenv/bin:/home/iva/.rbenv/shims:/home/iva/.rbenv/bin:/home/iva/.rbenv/shims:/home/iva/.rbenv/bin:/home/iva/.rbenv/shims:/home/iva/.rbenv/bin:/home/iva/bin:/home/iva/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/iva/.rvm/bin:/home/iva/.rvm/bin:/home/iva/.rvm/bin:/home/iva/.rvm/bin:/home/iva/.rvm/bin
Upvotes: 0
Views: 513
Reputation: 28305
Why are you creating a new rails project with rails version 4.2.6
?? Is this really intentional?! Rails 4.2.6 was released on March 11, 2016. It is fairly old/outdated, and no longer supported. The latest version of rails is 6.1.4.1
.
The error message said that your version of bundler
is incompatible with the version of rails
. There is nothing in that error to suggest you needed to reinstall ruby, but I guess it didn't do any harm...
gem
and bundler
are different things. To check the version of bundler
, run: bundle -v
, not gem -v
. You should hopefully see 1.11.2
as you expected.
In short:
rails v4.2.6
, then run rails new
, I'd expect it to work. Your confusion seems to be between comparing versions of different things (namely ruby
, gem
and bundler
).Upvotes: 2