0

我在为其他人构建的 ruby​​ 应用程序启动服务器时遇到问题。当我运行“ruby server/script”命令时,会生成以下输出:

ruby script/server 
./script/../config/../vendor/rails/railties/lib/initializer.rb:7:in `require': no such file to load -- rails/version (LoadError)
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:7
    from ./script/../config/boot.rb:45:in `require'
    from ./script/../config/boot.rb:45:in `load_initializer'
    from ./script/../config/boot.rb:38:in `run'
    from ./script/../config/boot.rb:11:in `boot!'
    from ./script/../config/boot.rb:109
    from script/server:2:in `require'
    from script/server:2

我已经看了又看,似乎看不到任何解决方案。

眼镜:

Ruby 1.8.7, 
Rails 2.2.2, 
gem -v 1.8.25

编辑:
这样做之后,我仍然得到同样的错误:

[dralexmv@archbang rubygame]$ ruby script/server 
./script/../config/../vendor/rails/railties/lib/initializer.rb:7:in `require': no such file to load -- rails/version (LoadError)
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:7


版本:

[dralexmv@archbang rubygame]$ gem -v 
1.4.2 
[dralexmv@archbang rubygame]$ rails -v 
Rails 2.2.2 
[dralexmv@archbang rubygame]$ ruby -v 
ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-linux] 

编辑:宝石清单

*** LOCAL GEMS ***

actionmailer (2.2.2)
actionpack (2.2.2) 
activerecord (2.2.2) 
activeresource (2.2.2) 
activesupport (2.2.2) 
bundler (1.2.4) 
json (1.7.7) 
mysql (2.9.1) 
rails (2.2.2) 
rake (10.0.3) 
rdoc (4.0.0) 
rubygems-bundler (1.1.0) 
rubygems-update (1.4.2) 
rvm (1.11.3.6) 
sqlite3 (1.3.7) 

编辑:在测试应用程序上进行测试

[dralexmv@archbang test_a]$ ruby script/server
=> Booting WEBrick...
=> Rails 2.2.2 application started on `http://0.0.0.0:3000`
=> Ctrl-C to shutdown server; call with --help for options
[2013-03-10 12:06:35] INFO  WEBrick 1.3.1
[2013-03-10 12:06:35] INFO  ruby 1.8.7 (2012-10-12) [x86_64-linux]
[2013-03-10 12:06:35] INFO  WEBrick::HTTPServer#start: pid=11230 port=3000
4

1 回答 1

1

降级您的宝石并尝试。Rails 2.X 不适用于大于 1.5 的 gem 版本

sudo gem update --system 1.4.2
于 2013-03-10T17:37:38.607 回答