我已经将ruby升级到1.9.2,rubygems 1.5.0并按照本教程安装了最新的rails 3.0.3:
http://hivelogic.com/articles/ruby-rails-mongrel-mysql-osx
但现在我的现有项目已不再适用。如果我做一个“ruby script / about”,我明白了:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- /Users/sneigaard/work/rails/myproject/config/../vendor/rails/railties/lib/initializer (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:45:in `load_initializer'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:38:in `run'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:11:in `boot!'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:110:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/about:2:in `<main>'
如果我运行“mongrel_rails start”,我会收到此错误:
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require': no such file to load -- /Users/sneigaard/work/rails/myproject/config/../vendor/rails/railties/lib/initializer (LoadError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:45:in `load_initializer'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:38:in `run'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:11:in `boot!'
from /Users/sneigaard/work/rails/myproject/config/boot.rb:110
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
from /Users/sneigaard/work/rails/myproject/config/environment.rb:7
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `call'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `listener'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `call'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `initialize'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
from /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/bin/mongrel_rails:19:in `load'
from /usr/bin/mongrel_rails:19
在脚本/服务器中我有这个:
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/server'
我搜索并搜索了网,但我无法弄明白,我的项目被卡住了:(请帮助我。
谢谢
索伦
答案 0 :(得分:1)
它rails server
是否吐出同样的错误?你似乎在rails 3中使用rails 2命令。还有,你的所有宝石都加载到1.9.2吗?你必须在切换红宝石时重装一切。
答案 1 :(得分:1)
你的ruby会有一些配置错误
which ruby
gem environment
和
ruby -v
它是全能的吗?
我建议使用RVM 设置好文档非常简单,对你的商务很有用。
似乎您的项目仍然在rails 2.3。*而不是3.0。*,在rails 3中,thear不是脚本/服务器脚本文件。 将rvm ruby 1.9.2和正确的gem安装到您的项目中。
希望这可以提供帮助。
答案 2 :(得分:0)
将应用从1.8.7升级到1.9.2时出现此问题 在Ruby 1.9.2中,Kernel.require不像1.8那样工作,而是看起来他们希望你使用它 Kernel.require_relative
请参阅此处了解可在两种红宝石中使用的解决方案