嗨我一直在嘗試安裝Ruby gem bundle。收到此消息後,我按照gem install bundle
的指示操作,但當我輸入bundle -v
時仍不起作用。我還可以鍵入錯誤:沒有安裝Gem bundler,先運行`gem install bundler`
which bundle
和接收
/Users/edmundmai/.rvm/bin/bundle
所以它的存在!那爲什麼它不起作用呢!我沒有收到神祕的$ PATH有什麼問題嗎? (我是一個noob)。
這裏是我的.bash_profile:
PATH=$PATH:~/bin
export PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
這裏是我的.bashrc:
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
這裏是我的寶石ENV:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.3.1]
- INSTALLATION DIRECTORY: /Users/edmundmai/.rvm/gems/[email protected]
- RUBY EXECUTABLE: /Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /Users/edmundmai/.rvm/gems/[email protected]/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /Users/edmundmai/.rvm/gems/[email protected]
- /Users/edmundmai/.rvm/gems/[email protected]
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-rdoc --no-ri"
- "update" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- http://rubygems.org/
回聲$ PATH
/Users/edmundmai/.rvm/bin:/Users/edmundmai/.rvm/gems/[email protected]/bin:/Users/edmundmai/.rvm/gems/[email protected]/bin:/Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/edmundmai/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/edmundmai/bin:/Users/edmundmai/bin
UPDATE 所以在再次嘗試通過RoR教程之後,我重複了本章前面兩個終端窗口(讓我們稱之爲終端#1和終端#2)的一些步驟。終端#2仍然不起作用(命令行不在任何目錄中,只是默認目錄),而終端#1(在我的sample_app目錄中)起作用。我認爲rvm get head && rvm reload
可能是關鍵?但這是否意味着我每次打開終端時都必須運行該程序?看看我的終端#爲前1命令後(我刪除了一些輸出,這樣它會更清楚我的輸入線爲):
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle -v
ERROR: Gem bundler is not installed, run `gem install bundler` first.
Edmunds-MacBook-Pro:sample_app edmundmai$ gem install
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
Edmunds-MacBook-Pro:sample_app edmundmai$ rvm -v
rvm 1.15.8 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
Edmunds-MacBook-Pro:sample_app edmundmai$ rspec spec/
No DRb server is running. Running in local process instead ...
........
Finished in 0.36709 seconds
8 examples, 0 failures
Randomized with seed 59500
Edmunds-MacBook-Pro:sample_app edmundmai$ subl .
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle install --binstubs=./bundler_stubs
Using rake (0.9.2.2)
...
...
(**list of stuff)
Using uglifier (1.2.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle show bundler
/Users/edmundmai/.rvm/gems/[email protected]/gems/bundler-1.2.0
我非常清楚,以什麼$ PATH確實。如果你們需要更多的信息,隨時告訴我,我會提供。
你已經嘗試過(使用RVM僅當出現問題)
'寶石安裝bundle'但你有沒有試過'gem install bundler'? – cjc343
@ cjc343:'bundle' gem具有'bundler'作爲依賴,所以它具有相同的效果。 – jmdeldin
@Edmund:你編輯它之後是否開始了一個新的終端或者源自你的bash_profile?你可以將'echo $ PATH'的輸出粘貼到你的shell中嗎?你是如何安裝RVM的?我使用它已經有一段時間了,但一般來說,這是一個複製/粘貼和運行設置。 – jmdeldin