Подтвердить что ты не робот

LoadError работает с Mongrel с Rails3 и Ruby 1.9.2

Я новичок в программировании (ранее только html/css/design), пытаясь начать изучать RoR через книгу Simply Rails 2. Однако я хочу начать с самых последних версий Ruby (1.9.2) и Rails ( 3), поэтому я вынужден все настроить без книги. Я много посмотрел через google и на stackoverflow. Когда я запускаю rails server, он автоматически использует Webrick, но я хочу использовать Mongrel. Я установил preerelease Mongrel через gem install mongrel --pre и удалил предыдущую версию. Я прочитал, что для того, чтобы заставить Mongrel работать с rails server, мне пришлось добавить gem 'mongrel' в Gemfile, но я не знаю, к какому я должен добавить его (я попробовал несколько, но ничего не изменил). Поэтому я решил посмотреть документацию mongrel через git и узнал о mongrel_rails start, когда я запустил это:

C:\Ruby192\shovell>mongrel_rails start  
** Starting Mongrel listening at 0.0.0.0:3000  
** Starting Rails with development environment...   C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler/runtime.rb:27:in
'block in setup': You have already activated mongrel 1.2.
0.pre2, but your Gemfile requires mongrel 1.1.5. Consider using bundle exec. (Gem::LoadError)  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler/spec_set.rb:12:in
'block in each'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler/spec_set.rb:12:in
'each'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler/spec_set.rb:12:in
'each'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler/runtime.rb:17:in
'setup'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler.rb:100:in
'setup'  
from C:/Ruby192/shovell/config/boot.rb:8:in '<top (required)>'  
from <internal:lib/rubygems/custom_require>:29:in 'require'  
from <internal:lib/rubygems/custom_require>:29:in 'require'  
from C:/Ruby192/shovell/config/application.rb:1:in '<top (required)>'  
from <internal:lib/rubygems/custom_require>:29:in 'require'  
from <internal:lib/rubygems/custom_require>:29:in 'require'  
from C:/Ruby192/shovell/config/environment.rb:2:in '<top (required)>'  
from <internal:lib/rubygems/custom_require>:29:in 'require'  
from <internal:lib/rubygems/custom_require>:29:in 'require'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/rails.rb:147:in
'rails'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:116:in
'block (2 levels) in run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:149:in
'call'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:149:in
'listener'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:102:in
'block in run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:50:in
'call'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:50:in
'initialize'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:86:in
'new'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:86:in
'run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/command.rb:210:in
'run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:282:in
'<top (required)>'  
from C:/Ruby192/bin/mongrel_rails:19:in 'load'  
from C:/Ruby192/bin/mongrel_rails:19:in '<main>'` 

Мое лучшее предположение, что C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler/runtime.rb:27:in 'block in setup': You have already activated mongrel 1.2. 0.pre2, but your Gemfile requires mongrel 1.1.5. Consider using bundle exec. является ключом, но я не смог его решить.

Я был бы признателен за любую помощь, чтобы я мог научиться язык!

EDIT: Я смог пропустить вышеупомянутую проблему благодаря @duddle, но теперь у меня есть еще одна проблема... Я получаю эту ошибку:

C:\Ruby192\shovell>mongrel_rails start  
** Starting Mongrel listening at 0.0.0.0:3000  
** Starting Rails with development environment...   C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.rc2/lib/active_support/dependencies.rb:239:in
'req uire': no such file to load -- dispatcher (LoadError)  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.rc2/lib/active_support/dependencies.rb:239:in 'block in require'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.rc2/lib/active_support/dependencies.rb:225:in 'block in load_dependency'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.rc2/lib/active_support/dependencies.rb:591:in 'new_constants_in'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.rc2/lib/active_support/dependencies.rb:225:in 'load_dependency'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.rc2/lib/active_support/dependencies.rb:239:in 'require'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/rails.rb:148:in 'rails'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:116:in' block (2 levels) in run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:149:in 'call'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:149:in 'listener'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:102:in' block in run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:50:in 'call'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/configurator.rb:50:in 'initialize'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:86:in 'new'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:86:in'run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/command.rb:210:in 'run'  
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:282:in '<top (required)>'  
from C:/Ruby192/bin/mongrel_rails:19:in 'load'  
from C:/Ruby192/bin/mongrel_rails:19:in '<main>

Моя лучшая догадка в этот момент (1 утра... очень усталая) заключается в том, что мне не хватает файла или что-то не названо так, как должно быть. Возможно, мне нужно использовать действие :require в моем Gemfile.. может быть, мне просто нужно спать на нем. Ха.

Опять же, спасибо ton @duddle за то, что вы пропустили первую ошибку! Больше спасибо, спасибо!

4b9b3361

Ответ 1

Вы уже активировали mongrel 1.2. 0.pre2, но ваш Gemfile требует mongrel 1.1.5. Рассмотрите возможность использования bundle exec. является ключом, но я не смог его решить.

Ты был почти там!

gem 'mongrel', '>= 1.2.0.pre2'

Второй параметр указывает связующему, что требуется версия, равная или превышающая 1.2.0.pre2, которую вы должны использовать при использовании Ruby 1.9.2.

На странице Bundler есть хорошая ссылка о том, как использовать Gemfile: http://gembundler.com/gemfile.html

Ответ 2

На всякий случай вы не поняли.

Я запустил gem install 'dispatcher' и добавил gem 'dispatcher' в Gemfile моего приложения. Тогда все было хорошо.

Из небольшого опыта, который у меня есть с ruby, каждый раз, когда у меня возникает проблема "не загружать такой файл". Это потому, что у меня отсутствует конкретный камень.

Hth...

Ответ 3

добавьте эту строку в свой файл gem:

gem 'mongrel', '>= 1.2.0.pre2'

в командной строке:

run bundle install

Запустите mongrel, используя следующую команду:

rails server

Ответ 4

Эй, я столкнулся с этой проблемой, решение было довольно простым:

Просто добавьте gem 'dispatch'

; -)

Ответ 5

Монетный драгоценный камень не совместим с Ruby 1.9.2; вам придется использовать драгоценный камень "sho-mongrel" на своем месте.

Ответ 6

Попробуйте установить его, используя:

gem install mongrel --pre

Это сработало для меня идеально.