2016-11-25 66 views
3

我需要的ActiveRecord進行耙,但是當我嘗試安裝它,它說:ActiveRecord的需要Ruby版本> = 2.2.2

activesupport-5.0.0.1 requires ruby version >= 2.2.2, 
which is incompatible with the current version, ruby 1.9.3p484 

我試圖改變與rbenv紅寶石2.2.2

rbenv versions 

輸出

系統 * 2.2.2(由/home/user/.rbenv/version設置) 2.3.1

但是當我去紅寶石-v它說

紅寶石1.9.3p484(2013年11月22日修訂43786)x86_64的Linux的]

而且試圖消除它,但是當我安裝耙

sudo apt-get install rake 

,我得到這個輸出

下列額外的軟件包將被安裝:

libruby1.9.1紅寶石ruby1.9.1

但是,我需要紅寶石版本2.2.2或更高版本是活躍的(紅寶石-v )安裝活動記錄,以便我可以執行rake命令。

+2

你運行過'rbenv global 2.2.2'嗎? –

+0

是的,我做過了,在rbenv版本中有一個*,但它仍然看起來像1.9.3p484是活動的 – Strahinja90bg

回答

0

我曾與這一個幫助並解決它。就我而言,我改變Gemfile.lock的從

GEM 
    remote: http://rubygems.org/ 
    specs: 
    activemodel (5.0.0.1) 
     activesupport (= 5.0.0.1) 
    activerecord (5.0.0.1) 
     activemodel (= 5.0.0.1) 
     activesupport (= 5.0.0.1) 
     arel (~> 7.0) 
    activesupport (5.0.0.1) 
     concurrent-ruby (~> 1.0, >= 1.0.2) 
     i18n (~> 0.7) 
     minitest (~> 5.1) 
     tzinfo (~> 1.1) 
    arel (7.1.4) 
    concurrent-ruby (1.0.2) 
    i18n (0.7.0) 
    minitest (5.9.1) 
    mysql2 (0.4.5) 
    rake (11.3.0) 
    thread_safe (0.3.5) 
    tzinfo (1.2.2) 
     thread_safe (~> 0.1) 

PLATFORMS 
    ruby 

DEPENDENCIES 
    activerecord 
    mysql2 
    rake 

BUNDLED WITH 
    1.13.6 

這一個(最重要的是ActiveRecord的版本):

GEM 
    remote: http://rubygems.org/ 
    specs: 
    activemodel (3.1.3) 
     activesupport (= 3.1.3) 
     builder (~> 3.0.0) 
     i18n (~> 0.6) 
    activerecord (3.1.3) 
     activemodel (= 3.1.3) 
     activesupport (= 3.1.3) 
     arel (~> 2.2.1) 
     tzinfo (~> 0.3.29) 
    activesupport (3.1.3) 
     multi_json (~> 1.0) 
    arel (2.2.1) 
    builder (3.0.0) 
    i18n (0.6.0) 
    multi_json (1.0.4) 
    mysql2 (0.3.11) 
    rake (0.9.2.2) 
    tzinfo (0.3.31) 

PLATFORMS 
    ruby 

DEPENDENCIES 
    activerecord 
    mysql2 
    rake 

BUNDLED WITH 
    1.13.6 

然後安裝的ActiveRecord和其他所有我需要

gem install activerecord -v 3.1.3 
sudo apt-get install libmysqlclient-dev 
sudo apt-get install ruby1.9.1-dev 
gem install activerecord-mysql2-adapter 
gem uninstall mysql2 
gem install mysql -v 0.3.11 

耙子工作。

rake db:migrate[] 

希望這會幫助別人! :)

1

你搞砸了。

sudo apt-get install rake 

系統範圍 Debian軟件包,即一無所知rbenv。刪除它以及您刪除系統紅寶石。

之後,這樣做:

rbenv global 2.2.2 
gem install rake # ⇐ THIS 
相關問題