簡體   English   中英

如何獲得捆綁使用/查看RVM使用的Ruby版本?

[英]How do I get bundle to use/see the version of Ruby that RVM is using?

關於Ruby版本和RVM,這里有很多問題-我已經瀏覽了它們,但找不到針對我特定問題的解決方案:

據我所知,我已正確安裝和設置/配置了RVM。

$ ruby -v
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-darwin12.2.0]

但是,在運行捆綁安裝時,我收到此消息:

$ bundle install
Updating http://github.com/rails/prototype_legacy_helper.git
Fetching gem metadata from http://rubygems.org/......
Fetching gem metadata from http://rubygems.org/..
Enter your password to install the bundled RubyGems to your system: 
Using rake (10.0.3) 
Using RedCloth (4.2.9) 
Using i18n (0.6.1) 
Using multi_json (1.6.1) 
Using activesupport (3.2.12) 
Using builder (3.0.4) 
Using activemodel (3.2.12) 
Using erubis (2.7.0) 
...

...
Using eventmachine (1.0.0) 
Using excon (0.17.0) 
Installing factory_girl (3.6.2) 
Gem::InstallError: factory_girl requires Ruby version >= 1.9.2.
An error occurred while installing factory_girl (3.6.2), and Bundler cannot continue.
Make sure that `gem install factory_girl -v '3.6.2'` succeeds before bundling.

對我來說,重要的一行是factory_girl requires Ruby version >= 1.9.2. 這讓我認為捆綁軟件不符合RVM設置使用的紅寶石版本。 我不確定我的配置哪里出錯了。 我以前從未遇到過RVM的問題。 的確, gem install factory_girl -v '3.6.2'可以正常工作,但之后捆綁包仍然看不到它。

手動安裝factory_girl的輸出:

$ sudo gem install factory_girl -v '3.6.2'
Password:
Successfully installed factory_girl-3.6.2
1 gem installed
Installing ri documentation for factory_girl-3.6.2...
Installing RDoc documentation for factory_girl-3.6.2...

如何獲得捆綁包才能與RVM完美搭配?

檢查一次,做完后就可以了

$ rvm --default use 1.9.2

可能是因為您根本沒有使用rvm。 通過使用gem install,您已在系統上安裝了gem。 鑒於此,如果您沒有以root用戶身份安裝rvm,則需要在開始使用bundle並安裝gem之前設置ruby版本。

rvm完全透明地捆綁了這些東西。 如果正確使用,則捆綁包將按預期工作。

嘗試從系統中刪除您可能擁有的所有寶石。 然后使用rvm命令使用一些紅寶石版本,例如:

rvm use 1.9.2

然后,運行捆綁安裝。 = p

兩個因素:

  1. 不要使用sudo它使用非RVM命令,也不使用rubygems使用的RVM環境

  2. 檢查.bundle/config config-如果它包含PATH / STANDALONE ,它將強制捆綁程序跳過RVM寶石集,並在RVM范圍之外的本地目錄中使用額外的捆綁程序隔離, bundle install --system應該解決它,如果您使用capistrano捆綁程序集成設置適當的標志set :bundle_flags, "--system"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM