简体   繁体   中英

bundle install error - ruby_dep-1.5.0 requires ruby version >= 2.2.5 but I have version 3.0.1p64

I used to work in a project with a Ubuntu machine flawlessly. After some time, I decided to hop into Fedora and now that I've setup everything, I was going to continue the project but when I run bundle install I get the following:

➜ bundle install
Following files may not be writable, so sudo is needed:
  /usr/bin
  /usr/share/gems
  /usr/share/gems/build_info
  /usr/share/gems/bundler
  /usr/share/gems/cache
  /usr/share/gems/doc
  /usr/share/gems/extensions
  /usr/share/gems/gems
  /usr/share/gems/plugins
  /usr/share/gems/specifications
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies....
ruby_dep-1.5.0 requires ruby version >= 2.2.5, ~> 2.2, which is incompatible with the current version, ruby 3.0.1p64

Clearly my Ruby version requirement is met. Should I downgrade it so I could continue? If so, how to properly do it without rvm or rbenv?

I was able to find 2 lines with ruby_dep on Gemfile.lock and I'm not quite sure how to proceed. The first result is nested and the other isn't:

listen (3.1.5)
  rb-fsevent (~> 0.9, >= 0.9.4)
  rb-inotify (~> 0.9, >= 0.9.7)
  ruby_dep (~> 1.2)
...
ruby_dep (1.5.0)

Should I keep one or change the version of both? I couldn't find ruby_dep anywhere else besides Gemfile.lock

I ran into the same issue.

One method is to delete your Gemfile.lock and run bundle install

This deletes all existing references to ruby_dep and gives you a fresh install of your gems.

Deleting the whole Gemfile.lock file (as suggested in another answer) might not be the best idea.

First, simply try to update the ruby_dep in your dependencies:

bundle update ruby_dep

When it says it requires sudo to install gems, it's because you're using the system Ruby (Ruby that your OS uses), and it's not a good idea to alter that.

Install a different version of Ruby and confirm it's set to that, then bundle.

Step-by-step

  1. Add webrick gem to gemfile

  2. Remove specific jekyll version number from gemfile. Leave only gem "jekyll"

  3. Run bundler

  4. Run bundle exec jekyll serve --livereload

注意~> 2.2 ,它表示 2.x,而不是 3。在这里阅读更多https://bundler.io/gemfile.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM