我從RVM切換到了rbenv下面這個guideline,現在我可以使用捆綁和運行純Ruby,但是當我運行bin/rails s
,bin/rails g model ModelName
,或rails g model ModelName
我得到下面的錯誤:從RVM切換到rbenv後,我的紅寶石路徑被搞亂了嗎?
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
/Users/home/Development/blogger/vendor/bundle/gems/json-1.8.3/lib/json/ext/parser.bundle: [BUG] Segmentation fault at 0x00000000000418
ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-darwin15.0]
還有之後的一個大規模的崩潰報告,但我選擇不包括它,因爲它超過了允許的StackOverflow帖子長度,我不認爲它說什麼有價值。
我用ruby 2.1.2試過同樣的東西,得到了同樣的結果。我也做了gem install rubygems-update
其成功運行和gem pristine --all
它得到這個錯誤:
ERROR: While executing gem ... (Gem::Exception)
Failed to find gems ["==all"] >= 0
這裏是gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.4 (2014-10-27 patchlevel 265) [x86_64-darwin15.0]
- INSTALLATION DIRECTORY: /Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /Users/home/.rbenv/versions/2.1.4/bin/ruby
- EXECUTABLE DIRECTORY: /Users/home/.rbenv/versions/2.1.4/bin
- SPEC CACHE DIRECTORY: /Users/home/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/home/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0
- /Users/home/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/home/.rbenv/versions/2.1.4/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /Users/home/.rbenv/shims
- /Users/home/.rbenv/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
,爲什麼路徑進入2.1.0結果在創業板PATHS?這是我的老版本的紅寶石,我敢肯定,它甚至不在我的機器上。它不在rbenv versions
下列出。這是問題嗎?我如何更改寶石路徑,以及將其更改爲什麼?
我設置$ PATH在我的.bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
我的.profile文件是空的,echo $PATH
結果:/Users/home/.rbenv/shims:/Users/home/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
which ruby
結果/Users/home/.rbenv/shims/ruby
的另一個問題是,如果我嘗試要在我的主目錄中使用bundle
命令,即使bundler包含在我的gem列表中,我也會得到Could not locate Gemfile or .bundle/ directory
。
我已經嘗試卸載並重新安裝紅寶石至少三次,每次都收到相同的錯誤。我再次相信問題出在我的GEM PATH上,但我沒有足夠的經驗來知道如何解決它。謝謝。
GEM_PATHs是一個紅色的鯡魚。 Ruby的每個x.y版本的Gem存儲在同一個目錄中。 –
但是如果我使用的是2.1.2或2.1.4,2.1.0應該在我的GEM_PATH的末尾?我不確定還有什麼可能是錯的。 – usernm
是的,它應該。這是我評論的重點。我使用的是2.2.4,我的路徑在所有你的「2.1.0」的地方都有「2.2.0」。不幸的是,我不知道還有什麼不對。您需要更多地表徵它並更新您的問題。 –