LoadError running Mongrel with Rails3 and Ruby 1.9.2
Asked Answered
M

6

17

I am new to programming (previously only did html/css/design) trying to start learning RoR via the book Simply Rails 2. However I want to start with the most recent versions of Ruby(1.9.2) and Rails (3) so I am forced to get everything configured without the book. I have looked a lot via google and on stackoverflow. When I run rails server it automatically uses Webrick, but I want to be using Mongrel. I installed the prerelease Mongrel via gem install mongrel --pre and removed the previous version. I read that in order to get Mongrel to work with rails server I had to add gem 'mongrel' to the Gemfile, but I do not know which one I should be adding it to (I tried several but nothing changed). So I decided to look at mongrel documentation via git and learned about mongrel_rails start when I run that I get this:

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>'` 

My best guess is that 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. is the key but I have not been able to solve it.

I would appreciate any help so that I can get on to actually learning the language!

EDIT: I was able to get past the above issue thanks to @duddle but now I have another issue...I am getting this error:

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>

My best guess at this point (1am...very tired) is that I am missing a file or something is not named as it should be..maybe i need to use the :require action in my Gemfile..maybe I just need to sleep on it. Ha.

Again, thanks a ton @duddle for getting me past the first error! Any more help is greatly appreciated!

Masked answered 26/10, 2010 at 2:42 Comment(2)
have you again executed bundle install or/and bundle update? Then try to start the server the normal way via rails server. After adding gem 'mongrel', '>= 1.2.0.pre2' to your Gemfile you dont have to use mongrel_rails start anymore.Ultimate
Haha, woke up this morning and realized I had commented the line out ("# ") whoops. all fixed now! Works with rails server Thanks so much!...When I get more reputation I'll come back here and +1 your answer.Masked
U
32

You have already activated mongrel 1.2. 0.pre2, but your Gemfile requires mongrel 1.1.5. Consider using bundle exec. is the key but I have not been able to solve it.

You were almost there!

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

The second parameter tells bundler to require a version equal to or greater than 1.2.0.pre2, which you have to use when using Ruby 1.9.2.

The Bundler page provides a nice reference on how to use the Gemfile: http://gembundler.com/gemfile.html

Ultimate answered 26/10, 2010 at 6:11 Comment(1)
Thanks so much, I read the gembundler page and was able to figure out which Gemfile to edit (my app's). However, now I have another issue...go figure. Please check out my editMasked
H
5

Just in case you didn't figure it out.

I ran gem install 'dispatcher' and added gem 'dispatcher' in the Gemfile of my app. Then everything was fine.

From the small experience I have with ruby, everytime I have a "require -- no such file to load" problem. It is because I am missing a specific gem.

Hth...

Hemlock answered 6/12, 2010 at 20:28 Comment(1)
This is what got me on to the next step in the end.Pursy
T
4

add this line to your gem file:

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

at the command prompt:

run bundle install

start mongrel using this command:

rails server
Techy answered 1/2, 2011 at 12:43 Comment(0)
L
0

Hey, I ran into that problem, the solution was quite simple:

Just add the gem 'dispatch'

;-)

Lianne answered 21/12, 2010 at 16:54 Comment(1)
brings the error: uninitialized constant Dispatch::Source::PROC_EXITLitigious
M
0

The mongrel gem isn’t compatible with Ruby 1.9.2; you’ll have to use gem 'sho-mongrel' in its place.

Marion answered 18/3, 2011 at 8:20 Comment(1)
To add to and clarify your response - the default mongrel gem isn't compatible. If you use mongrel >= 1.2.0pre2, in my experience, it is fine with Ruby 1.9.2. I'm not familiar with 'sho-mongrel' so I can't comment on that suggestion.Eightfold
R
0

Try to install it using:

gem install mongrel --pre

It worked for me perfect!!!

Rosio answered 7/6, 2012 at 10:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.