Bundle无法识别已安装的宝石

时间:2016-07-12 17:26:54

标签: ruby-on-rails ruby rubygems bundler rack

我正在尝试运行“bundle install --without production”,结果是:

bundle install --without production
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies..............
Using rake 11.2.2
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Installing rack 2.0.1

Gem::InstallError: rack requires Ruby version >= 2.2.2.
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.0.0
Using bundler 1.12.5
Using byebug 9.0.5
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using method_source 0.8.2
Using thor 0.19.1
Using debug_inspector 0.0.2
Using ffi 1.9.14
Using multi_json 1.12.1
Using rb-fsevent 0.9.7
Using puma 3.4.0
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Using sqlite3 1.3.11
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.6.8
An error occurred while installing rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.

所以多次,我跑了

gem install rack -v 2.0.1

结果:

Successfully installed rack-2.0.1
Parsing documentation for rack-2.0.1
Done installing documentation for rack after 3 seconds
1 gem installed

我调用“rbenv rehash”并重试bundle install并显示完全相同的错误消息。当我调用“ruby -v”时,它显示我有ruby版本2.3.1。如何让捆绑包识别我已更新Ruby?这是Bundler的问题吗?我把宝石保存到了错误的地方吗?我已经搜索了几个小时的类似问题,没有一个解决方案有效。

1 个答案:

答案 0 :(得分:1)

错误说您需要2.2.2或更高版本的Ruby版本。你能查看一下你的版本吗?命令行中的ruby -v应该可以正常工作

编辑:看起来你只需重新启动终端窗口......