Rails:gem.config&耙宝石:安装 - 没有这样的文件加载 [英] Rails: gem.config & rake gems:install -- no such file to load
问题描述
我试图使用config / environment.rb来安装ruby gem dependency(因为我没有sudo访问我们的服务器; ergo,不能只调用 gem install hpricot
)。
我尝试过包括各种参数(:version ,
:source
,:lib
),但我仍然得到 rake中止!没有这样的文件加载 - hpricot
更新:事实证明,当我删除插件hpricot,那么我可以成功执行 rake gems:install
。但这不是很有帮助。这意味着如果我移动我的应用程序,就会遇到无法榨取其宝石的问题(因为我将重新安装插件并添加依赖它的功能)。
这应该如何工作?
Sys:,WinXP,Ruby 1.8.7,Rails 2.3.5
建议使用 bundler ,如果这是一个选项。
Bundler允许您将宝石安装到任何您想要的目的地,专门用于侧面描述整个需要 sudo
问题。它通常像这样简单:
bundle install --path〜/ my_gems /
您可以通过以下几个简单的步骤,从那里你的生活会更容易。
I'm trying to use config/environment.rb to install a ruby gem dependency (because I don't have sudo access to our server; ergo, can't just call gem install hpricot
).
I've tried including sundry arguments (:version
, :source
, :lib
) but I still get rake aborted! no such file to load -- hpricot
Update: It turns out that when I remove the plugin which requires hpricot, then I can execute rake gems:install
successfully. But that's not very helpful. It means that if I ever move my app, I run into a problem of being unable to rake its gems (because I will have reinstalled the plugin and added features that depend on it).
How is this supposed to work?
Sys: WinXP, Ruby 1.8.7, Rails 2.3.5
rake gems:install
has been deprecated because it never really worked. You can imagine having a gem installer with dependencies to the very gems it's trying to install is a bad idea.
It's advisable to use bundler instead if that's an option.
Bundler allows you to install gems to any destination you want, something specifically intended to side-step the whole "requires sudo
" problem you describe. It's often as easy as this:
bundle install --path ~/my_gems/
You can make your Rails 2.3.x application use Bundler by following a few simple steps and from there your life will be a lot easier.
这篇关于Rails:gem.config&耙宝石:安装 - 没有这样的文件加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!