首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

使用Rails时遇到了服务器启动有关问题 script/server:3

2012-11-17 
使用Rails时遇到了服务器启动问题 script/server:3境 Windows Vista Home Premiumc:\RubyApps\blog2ruby

使用Rails时遇到了服务器启动问题 script/server:3
境 Windows Vista Home Premium

c:\RubyApps\blog2>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

c:\RubyApps\blog2>gem -v
0.9.5

1 使用gem更新gem自己

  gem update --system

2 安装rails

  gem install rails --include-dependencies

  之后确认版本:

  c:\RubyApps\blog2>rails -v
Rails 2.0.1

3 使用mongrel服务器(Ruby默认没有安装)

  gem install mongrel

  此时使用ruby script/server 启动服务器的时候会出现如下错误:

  c:\RubyApps\blog2>ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
Exiting
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_re
quire': no such file to load -- c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.1-x86
-mswin32-60/lib/mongrel/init.rb (MissingSourceFile)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re
quire'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_suppo
rt/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_suppo
rt/dependencies.rb:342:in `new_constants_in'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_suppo
rt/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:1
34:in `load'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:166:in `eac
h'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:166:in `eac
h'
from c:/ruby/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:1
12:in `load'
... 21 levels...
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/commands/server.rb:3
9
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `ge
m_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `re
quire'
from script/server:3

原因是:mongrel安装目录和rails 2 中配置的目录不一致,可以将mongrel目录修改为

C:\ruby\lib\ruby\gems\1.8\gems\mongrel-1.1.1-mswin32
=>
C:\ruby\lib\ruby\gems\1.8\gems\mongrel-1.1.1-x86-mswin32-60
即可

热点排行