如何修复我的路径和宝石设置以获得rake在dreamhost上看到自己?

时间:2021-07-15 07:16:12

I'm trying to get a Ruby on Rails project started on Dreamhost, ruby version 1.8.7 I can't check the rails version because of the rake problem but I believe it's at least 3.0. I was having trouble getting the mysql2 connector to work with rake db:migrate and I was trying different versions of gems, and I installed a local version of bundle on ~/.gems, then uninstalled it, and now bundle and rake don't see the gems installed in /usr/lib/ruby/gems/1.8/bin.

我正在尝试在Dreamhost上启动Ruby on Rails项目,ruby版本1.8.7由于rake问题我无法检查rails版本,但我相信它至少是3.0。我无法让mysql2连接器与rake db:migrate一起工作,我正在尝试不同版本的gem,我在〜/ .gems上安装了本地版本的bundle,然后将其卸载,现在捆绑和rake不查看安装在/usr/lib/ruby/gems/1.8/bin中的gem。

I tried following http://wiki.dreamhost.com/Rails_3 to see if it was a path issue before I realized the local bundle gem may have caused the problem, and I erased my PATH by not including :$PATH at the end of the export command the first time. I looked up common $PATH variables and after following the link above the following are set to:

在我意识到本地bundle gem可能导致问题之前,我试着关注http://wiki.dreamhost.com/Rails_3以查看它是否是一个路径问题,并且我删除了我的PATH,不包括:$ PATH结束时第一次导出命令。我查找了常见的$ PATH变量,并在按照上面的链接后将以下内容设置为:

$GEM_HOME = ~/.gems

$ GEM_HOME =〜/ .gems

$GEM_PATH = /usr/lib/ruby/gems/1.8

$ GEM_PATH = /usr/lib/ruby/gems/1.8

$PATH = ~/.gems/bin:/usr/lib/ruby/gems/1.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

$ PATH =〜/ .gems / bin:/usr/lib/ruby/gems/1.8/bin:/ usr / local / bin:/ usr / bin:/ bin:/ usr / bin / X11:/ usr / games

So now I'm not quite sure if there was something in the $PATH that is now missing, or if it was the bundle install/uninstall in ~/.gems that make it so when I try to run rake db:migrate or bundle exec rails console I get the error "Could not find rake-0.8.7 in any of the sources".

所以现在我不太确定$ PATH中是否存在现在缺少的东西,或者是否是〜/ .gems中的bundle install / uninstall,当我尝试运行rake db:migrate或bundle时exec rails console我收到错误“无法在任何来源中找到rake-0.8.7”。

EDIT: I tried following the directions on http://forums.site5.com/showthread.php?p=87539 so I added the GEM_PATH in environment.rb which points to the local and shared gem directories, ran irb and tried require 'rubygems' and require 'rake' which both worked, $: showed the correct version of rake, but still get the same error when trying to run rake db:migrate in the RoR app directory, "Could not find rake-0.8.7 in any of the sources".

编辑:我尝试按照http://forums.site5.com/showthread.php?p=87539上的说明进行操作,所以我在environment.rb中添加了GEM_PATH,它指向本地和共享的gem目录,运行irb并尝试了' rubygems'和要求'rake'都有效,$:显示正确的rake版本,但在尝试运行rake db:migrate时仍然会在RoR app目录中遇到相同的错误,“找不到rake-0.8.7 in任何来源“。

EDIT: After getting rvm setup I was at the same spot, but after reading http://muffinlabs.com/content/rvm-and-bundler-dreamhost I changed the GEM_HOME and GEM_PATH vars (in config/evironment.rb instead of config.ru) to the rvm setup ones and rake no longer gives the "Could not find rake" error. The mysql2 adapter still doesn't work but that's another issue.

编辑:获得rvm设置后,我在同一地点,但在阅读http://muffinlabs.com/content/rvm-and-bundler-dreamhost后,我更改了GEM_HOME和GEM_PATH变量(在config / evironment.rb而不是config中) .ru)到rvm setup和rake不再给出“找不到rake”错误。 mysql2适配器仍然无法正常工作,但这是另一个问题。

1 个解决方案

#1


1  

Use rvm. It handles any number of different versions of rubies and gems to avoid exactly this kind of headache.

使用rvm。它处理任意数量的不同版本的红宝石和宝石,以避免这种头痛。

#1


1  

Use rvm. It handles any number of different versions of rubies and gems to avoid exactly this kind of headache.

使用rvm。它处理任意数量的不同版本的红宝石和宝石,以避免这种头痛。