我有一個rails應用程序,我有點新的rails。Ruby Gemfile與Ruby版本不匹配,但匹配ruby -v輸出
我的主要問題是我在生產服務器上,無法運行bundle
。 它給這個錯誤:
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.7
所以,我曾嘗試使用rbenv,但它不是作爲SUCESSFUL可以看到下面。
$:/home/deploy/my-app/current$ rbenv global 2.1.7
$:/home/deploy/my-app/current$ bundle
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.7
$:/home/deploy/my-app/current$ ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
使用RVM似乎別人都在用在其他問題的話,但我真的只是想紅寶石的一個版本上運行(被指定的一個)
此服務器將成爲生產,但目前沒有生活。
編輯1:gem install bundler
我試圖安裝包,而在紅寶石2.1.7但這並沒有工作。
這裏是我做過什麼:
$:/home/deploy/my-app/current$ ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
$:/home/deploy/my-app/current$ gem install bundler
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
Parsing documentation for bundler-1.11.2
Installing ri documentation for bundler-1.11.2
Done installing documentation for bundler after 4 seconds
1 gem installed
$:/home/deploy/my-app/current$ bundle
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.7
EDIT 2which bundle
$:/home/deploy/my-app/current$ which bundle
/usr/local/bin/bundle
「哪個包」顯示什麼?這可能是因爲你沒有在2.1.7中安裝Bundler,但是它的版本是1.9.3(我猜測它是由操作系統提供的Ruby版本),當你運行'bundle'時會發現這個版本。 。您可能只需要在2.1.7中安裝gem install bundler。 – matt
'哪個bundle給出:/ usr/local/bin/bundle @matt – Rorschach
你是否在使用Bash作爲shell?安裝捆綁軟件後,嘗試運行'hash -r'(或者啓動一個新的會話)。你的shell可能已經將路徑緩存到了舊版本的'bundle',所以你可能仍然會得到它,而不是新的。 – matt