找不到 RubyGem haml
使用全新安装的 Ruby 1.9.2(通过 RVM)、Textmate 和 Handcrafted Haml 包,在尝试使用它时出现以下错误:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in report_activate_error':找不到 RubyGem haml (>= 0) (Gem::LoadError) 从 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:inactivate' 从 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem' from -e:1
我运行 sudo gem install haml 并成功安装。 ruby -v 的输出是 1.9.2p180。看来 TextMate 仍在寻找我的系统 (Mac OS X) 版本的 Ruby,而不是我安装的新版本 (1.9.2)。当我查看 RVM 管理的 Ruby 1.9.2 安装的 gemset 时,Haml gem 已加载。关于如何让 TextMate 在我的新/正确的宝石集中搜索宝石有什么想法吗?
Using a fresh install of Ruby 1.9.2 (via RVM), Textmate, and the Handcrafted Haml bundle, I get the following error when trying to use it:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in
report_activate_error': Could not find
RubyGem haml (>= 0) (Gem::LoadError)
from
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:inactivate'
from
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem' from -e:1
I ran sudo gem install haml and it installed successfully. The output of ruby -v is 1.9.2p180. It seems like TextMate is still looking for my system (Mac OS X) version of Ruby, not the new one (1.9.2) I installed. When I look at the gemsets for my RVM-managed Ruby 1.9.2 installation, the Haml gem is loaded. Any thoughts on how to get TextMate to search for the gem in my new/correct gemset?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要告诉 TextMate 使用哪种 Ruby。正如您所猜测的,并且可以从错误中看到,TextMate 的 PATH 导致它使用
/usr/bin/ruby
。请参阅这些问题及其答案:我个人使用我自己的非 RVM 手工编译的 Ruby在
/usr/local/bin
中,所以我进入TextMate->首选项->高级->Shell 变量
并创建一个名为
PATH
的变量,并将其设置为/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
请注意,我已将
/usr/local/bin
> 在/usr/bin
之前,以便我的ruby
在系统之前找到。You need to tell TextMate which Ruby to use. As you guessed and can see from the error, the PATH for TextMate causes it to use
/usr/bin/ruby
. See these questions and their answers:I personally use my own non-RVM hand-compiled Ruby in
/usr/local/bin
and so I go intoTextMate->Preferences->Advanced->Shell Variables
and create a variable named
PATH
that is set to/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Note that I've put
/usr/local/bin
before/usr/bin
so that myruby
is found before the system's.