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 *. 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:
我是编程(以前只做html / css / design)的新手,试图通过Simply Rails 2开始学习RoR。但是我想从最新版本的Ruby(1.9.2)和Rails(3)开始我*在没有这本书的情况下完成所有配置。我通过谷歌和*看了很多。当我运行rails服务器时它自动使用Webrick,但我想使用Mongrel。我通过gem install mongrel --pre安装了预发布的Mongrel并删除了以前的版本。我读到为了让Mongrel与rails服务器一起工作,我不得不在Gemfile中添加gem'mongrel',但我不知道应该将它添加到哪一个(我尝试了几个但没有改变)。所以我决定通过git查看mongrel文档并了解mongrel_rails在我运行时开始我得到了这个:
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.
我最好的猜测是C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.0.rc.6/lib/bundler/runtime.rb:27:在'block in setup'中:你已经启动了mongrel 1.2。 0.pre2,但你的Gemfile需要mongrel 1.1.5。考虑使用bundle exec。是关键但我无法解决它。
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:
编辑:由于@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>
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.
我在这一点上最好的猜测(凌晨1点......非常累)是我错过了一个文件或者没有命名的东西应该是..我可能需要在我的Gemfile中使用:require action.maybe我只是需要睡在上面。哈。
Again, thanks a ton @duddle for getting me past the first error! Any more help is greatly appreciated!
再次感谢@duddle让我超越第一个错误!非常感谢任何帮助!
6 个解决方案
#1
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.
你已经激活了mongrel 1.2。 0.pre2,但你的Gemfile需要mongrel 1.1.5。考虑使用bundle exec。是关键但我无法解决它。
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.
第二个参数告诉bundler需要一个等于或大于1.2.0.pre2的版本,在使用Ruby 1.9.2时必须使用它。
The Bundler page provides a nice reference on how to use the Gemfile: http://gembundler.com/gemfile.html
Bundler页面提供了有关如何使用Gemfile的很好的参考:http://gembundler.com/gemfile.html
#2
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.
我运行了gem install'dispatcher'并在我的应用程序的Gemfile中添加了gem'dispatcher'。一切都很好。
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.
从我对ruby的小经验来看,每次我都有“需要 - 没有这样的文件加载”的问题。这是因为我错过了一个特定的宝石。
Hth...
心连心...
#3
4
add this line to your gem file:
将此行添加到您的gem文件中:
gem 'mongrel', '>= 1.2.0.pre2'
at the command prompt:
在命令提示符下:
run bundle install
运行捆绑安装
start mongrel using this command:
使用此命令启动mongrel:
rails server
#4
0
Hey, I ran into that problem, the solution was quite simple:
嘿,我遇到了这个问题,解决方案非常简单:
Just add the gem 'dispatch'
只需添加gem'dispatch'
;-)
;-)
#5
0
The mongrel gem isn’t compatible with Ruby 1.9.2; you’ll have to use gem 'sho-mongrel' in its place.
mongrel gem与Ruby 1.9.2不兼容;你必须在它的位置使用宝石'sho-mongrel'。
#6
0
Try to install it using:
尝试使用以下方法安装它:
gem install mongrel --pre
It worked for me perfect!!!
它对我来说很完美!!!
#1
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.
你已经激活了mongrel 1.2。 0.pre2,但你的Gemfile需要mongrel 1.1.5。考虑使用bundle exec。是关键但我无法解决它。
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.
第二个参数告诉bundler需要一个等于或大于1.2.0.pre2的版本,在使用Ruby 1.9.2时必须使用它。
The Bundler page provides a nice reference on how to use the Gemfile: http://gembundler.com/gemfile.html
Bundler页面提供了有关如何使用Gemfile的很好的参考:http://gembundler.com/gemfile.html
#2
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.
我运行了gem install'dispatcher'并在我的应用程序的Gemfile中添加了gem'dispatcher'。一切都很好。
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.
从我对ruby的小经验来看,每次我都有“需要 - 没有这样的文件加载”的问题。这是因为我错过了一个特定的宝石。
Hth...
心连心...
#3
4
add this line to your gem file:
将此行添加到您的gem文件中:
gem 'mongrel', '>= 1.2.0.pre2'
at the command prompt:
在命令提示符下:
run bundle install
运行捆绑安装
start mongrel using this command:
使用此命令启动mongrel:
rails server
#4
0
Hey, I ran into that problem, the solution was quite simple:
嘿,我遇到了这个问题,解决方案非常简单:
Just add the gem 'dispatch'
只需添加gem'dispatch'
;-)
;-)
#5
0
The mongrel gem isn’t compatible with Ruby 1.9.2; you’ll have to use gem 'sho-mongrel' in its place.
mongrel gem与Ruby 1.9.2不兼容;你必须在它的位置使用宝石'sho-mongrel'。
#6
0
Try to install it using:
尝试使用以下方法安装它:
gem install mongrel --pre
It worked for me perfect!!!
它对我来说很完美!!!