【问题标题】:Your Ruby version is 2.3.0, but your Gemfile specified 2.1.2您的 Ruby 版本是 2.3.0,但您的 Gemfile 指定了 2.1.2
【发布时间】:2016-06-20 08:35:49
【问题描述】:

我正在尝试设置一个现有项目, 运行 bundle install 时,出现以下错误。

我尝试了许多可能的解决方案,但对我不起作用,我也运行了建议的命令,例如 gem pristine bcrypt --version 3.1.10,但对我不起作用。

    bipashant@bipashant-Inspiron-5537:~/sanokam$ bundle install

    Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
    Ignoring curb-0.9.3 because its extensions are not built.  Try: gem pristine curb --version 0.9.3
    Ignoring debug_inspector-0.0.2 because its extensions are not built.  Try: gem pristine debug_inspector --version 0.0.2
    Ignoring eventmachine-1.0.3 because its extensions are not built.  Try: gem pristine eventmachine --version 1.0.3
    Ignoring executable-hooks-1.3.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.3.2
    Ignoring ffi-1.9.8 because its extensions are not built.  Try: gem pristine ffi --version 1.9.8
    Ignoring gem-wrappers-1.2.7 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.2.7
    Ignoring gherkin-2.12.2 because its extensions are not built.  Try: gem pristine gherkin --version 2.12.2
    Ignoring http_parser.rb-0.5.3 because its extensions are not built.  Try: gem pristine http_parser.rb --version 0.5.3
    Ignoring kgio-2.8.1 because its extensions are not built.  Try: gem pristine kgio --version 2.8.1
    Ignoring mysql2-0.3.14 because its extensions are not built.  Try: gem pristine mysql2 --version 0.3.14
    Ignoring nokogiri-1.6.7 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7
    Ignoring ruby-prof-0.14.2 because its extensions are not built.  Try: gem pristine ruby-prof --version 0.14.2

    Your Ruby version is 2.3.0, but your Gemfile specified 2.1.2

更新 1

bipashant@bipashant-Inspiron-5537:~/sanokam$ rvm list

rvm rubies

=* ruby-2.1.2 [ x86_64 ]
   ruby-2.3.0 [ x86_64 ]
   ruby-2.3.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

我还有一个 ruby​​ 版本的 Gemfile。

source 'http://rubygems.org'

ruby '2.1.2'

任何建议将不胜感激,谢谢。

【问题讨论】:

  • 您尝试使用哪个 ruby​​ 版本?
  • @bibek-sharma 你能提供你的 Gemfile 的内容吗
  • @Deepak,我使用的是 ruby​​ 2.1.2,我已经更新了上面的帖子。
  • 你解决问题了吗?
  • @mlovic,还没有兄弟,我已经在 gem 文件上设置了 ruby​​ 2.3.0 并删除了 GemFile.lock 并尝试捆绑但不知道为什么要花费太多时间。跨度>

标签: ruby-on-rails ruby ruby-on-rails-3 rvm bundle


【解决方案1】:

你的 Gemfile 可能有这行:

ruby '2.1.2'

而且您使用的是 ruby​​ 2.3.0,所以您可以:

  1. 在 rvm/rbenv/chruby 的帮助下切换到 ruby​​ 2.1.2
  2. 再次将您的 Gemfile 更新为 ruby '2.3.0'bundle install

【讨论】:

  • 日志是否仍然显示:`您的 Ruby 版本是 2.3.0,但您的 Gemfile 指定了 2.1.2`?
  • 我正在尝试使用 2.1.2 并且默认使用 2.1.2,我已经更新了我的帖子。请你看看。
  • 是的,还是同样的问题。
  • 这很奇怪。您是否尝试过ruby -v 来查看您是否使用的是 2.1.2?如果您使用的是 2.1.2,并且捆绑器报告您使用的是 2.3.0,那没有多大意义。
  • ruby 2.1.2p95(2014-05-08 修订版 45877)[x86_64-linux]
【解决方案2】:

错误似乎很明显。您要么必须更改 Gemfile 中指定的 ruby​​ 版本,要么通过 rvm use 2.1.2 更改您正在使用的 ruby​​ 版本。您可以使用rvm --default use 2.1.2 将其设为默认版本。

【讨论】:

  • 如果没有特别的理由使用2.1.2 版本,你最好使用2.3.0。你可以通过编辑你的 Gemfile 来做到这一点,说ruby '2.3.0'
  • 我也试过这个,但是在安装 bundle install 时出现了很多错误。
  • 是同一个错误吗?如果这次错误有所不同,请将其发布在此处或作为您问题的一部分。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-04
  • 2014-05-27
  • 2018-06-09
  • 2018-07-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多