在sudo gem install之后无法访问Jekyll

时间:2015-09-22 09:00:36

标签: ruby jekyll

最初,我无法通过此安装宝石。

$ gem install jekyll 
ERROR:  Error installing jekyll:
invalid gem: package metadata is missing in /usr/local/rvm/gems/ruby-1.9.3-p392/cache/fast-stemmer-1.0.2.gem

然后一些指南建议使用sudo,所以我使用了

$ sudo gem install jekyll

表示已安装,但随后......

Successfully installed jekyll-2.5.3
Parsing documentation for jekyll-2.5.3
Done installing documentation for jekyll after 1 seconds
1 gem installed

$ jekyll -v

/Users/vincentchin/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'jekyll' (>= 0) among 105 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/usr/local/rvm/gems/ruby-1.9.3-p392:/usr/local/rvm/gems/ruby-1.9.3-p392@global', execute `gem env` for more information
from /Users/vincentchin/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/vincentchin/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /Users/vincentchin/.rbenv/versions/2.2.2/bin/jekyll:22:in `<main>'

我猜测通过运行sudo安装版本,我需要一个不同的命令或路径才能访问gem?或者它安装的位置可能无法被尝试执行的任何内容识别?

我已经查找过其他人在安装Jekyll时遇到问题的其他案例,并且遇到了一些我无法理解的研究。 所以如果需要这些信息来调查我的问题......

目前正在运行OS X Yosemite 10.10.5

echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/vincentchin/.rbenv/shims:/Users/vincentchin/.rbenv/shims:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin

RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin14]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p392
  - RUBY EXECUTABLE: /Users/vincentchin/.rbenv/versions/2.2.2/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p392/bin
  - SPEC CACHE DIRECTORY: /Users/vincentchin/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/vincentchin/.rbenv/versions/2.2.2/etc
  - RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
  - GEM PATHS:
 - /usr/local/rvm/gems/ruby-1.9.3-p392
 - /usr/local/rvm/gems/ruby-1.9.3-p392@global
  - GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :backtrace => false
 - :bulk_threshold => 1000
  - REMOTE SOURCES:
 - https://rubygems.org/
  - SHELL PATH:
 - /Users/vincentchin/.rbenv/versions/2.2.2/bin
 - /usr/local/Cellar/rbenv/0.4.0/libexec
 - /Library/Frameworks/Python.framework/Versions/2.7/bin
 - /Users/vincentchin/.rbenv/shims
 - /Users/vincentchin/.rbenv/shims
 - /usr/local/rvm/gems/ruby-1.9.3-p392/bin
 - /usr/local/rvm/gems/ruby-1.9.3-p392@global/bin
 - /usr/local/rvm/rubies/ruby-1.9.3-p392/bin
 - /usr/local/rvm/bin
 - /usr/local/bin
 - /usr/bin
 - /bin
 - /usr/sbin
 - /sbin
 - /usr/local/git/bin
 - /opt/sm/bin
 - /opt/sm/pkg/active/bin
 - /opt/sm/pkg/active/sbin

2 个答案:

答案 0 :(得分:0)

你有两个ruby版本,试试看:

bundle exec jekyll -v

答案 1 :(得分:0)

我卸载了所有内容(rvm和rbenv)并清理了卸载时没有获得的任何剩余文件,并使用ruby重新安装了rvm stable。

从那里我可以使用

安装
gem install jekyll

从那里一切顺利。

我想在我开始时的某个时刻,我安装了一堆东西而不知道它们的用途(rbenv和rvm,应该只有两个中的一个)。