0

I just set up a rails project and everything was fine until I tried to add a couple of gems to the gem file. I run bundle install and:

Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
zeitwerk-2.3.1 requires ruby version >= 2.4.4, which is incompatible with the
current version, ruby 2.3.3p222

So checking my ruby version :

$ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]

I tried to change the ruby version to the one is saying I have on the gem file, but that messes up with other gems. If it is helpful, I am using windows but never had a problem with that, although is always giving me some kind of issue.

I would appreciate any ideas, thanks.

Mario Garcia
  • 177
  • 1
  • 4
  • 15
  • How are you trying to "change the ruby version"? `rvm`? `rbenv`? `chruby`? Multiple system ruby installs? It looks like you've got some conflict between the your local ruby and the one `bundler` is using, but without more information on the setup it's hard to advise next steps. – Tom Lord Jul 08 '20 at 13:45
  • What I tried is to change the ruby version of my gemfile, so instead of 2.6.5, I wrote the one that the error says I have, which is 2.3.3 but when I check my ruby version is 2.6.5. I had set up another project with the same version of bundler and ruby and nothing happened. – Mario Garcia Jul 08 '20 at 14:09
  • I'm confused by your explanation. I **think** what is happening is that you have two conflicting versions of ruby on your machine, installed without a ruby version manager. You've installed ruby version `2.3.3` *and* `2.6.5`. When you run `ruby -v` it's using `2.6.5`. But when you run `bundle`, it's using the `2.3.3`-installation of the gem. To be clear, your `Gemfile` should **not** be specifying an old version of ruby that's incompatible with the gems. You didn't show the `Gemfile` in your post, but I would expect it to contain a line like: `ruby '2.6.5'`. – Tom Lord Jul 08 '20 at 15:35
  • If you only need one version of ruby on your machine (`2.6.5`?), and have no need for any other versions, especially old versions like `2.3.3`, then you could try just doing a reinstall; being extra careful to look for any traces of the old version and removing it completely. – Tom Lord Jul 08 '20 at 15:37
  • yes, as you say, in my gemfile is 2.6.5. How would you recommend to unistall it?. It is weird cause the previous project I was doing, it didn´t complaing about a rbuy version. – Mario Garcia Jul 09 '20 at 08:10
  • I am also trying to add install rvm and manage the version there, but it is not doing anything: ```Required ruby-2.6.5 is not installed. To install do: 'rvm install "ruby-2.6.5"'```. And when I try to install it: ```Error running './configure --prefix=/c/Users/Mario/.rvm/rubies/ruby-2.6.5 --disable-install-doc --enable-shared', please read /c/Users/Mario/.rvm/log/1594283612_ruby-2.6.5/configure.log There has been an error while running configure. Halting the installation. ``` – Mario Garcia Jul 09 '20 at 08:40
  • Did you read the error log? Did you try googling the error, to see if anyone has encountered it before and shared a solution? – Tom Lord Jul 09 '20 at 09:30
  • Of course I did, not much information tho, some bits and pieces. I managed to fix it. I had a local rails directory with ruby 2.3.3 in it, so I unistall it and then deleted manually the ruby 2.3.3 directory. After that I install bundle locally and rails and make sure which one was my ruby version again. I deleted my whole project and started over again, which wasn't much done anyway. Now it looks like it's working liek is supposed to. Thanks for your help Tom. – Mario Garcia Jul 09 '20 at 10:24

0 Answers0