Ubuntu 上的 Ruby on Rails 安装错误

发布于 2024-09-25 23:29:35 字数 5739 浏览 1 评论 0原文

我是 Rails 的新手。我刚刚开始学习 Ubuntu,我使用 10.04 版本,特别是在 Rails 上工作,并在我的大学项目中使用 feedzirra。

我收到以下错误。你能帮忙吗?

anergroup@ubuntu:~/ruby$ ruby -v
ruby 1.8.8dev (2010-10-01) [i686-linux]
anergroup@ubuntu:~/ruby$ rails -v
Rails 2.3.8

我拥有的 gems 列表是

anergroup@ubuntu:~/ruby$ sudo gem list

*** LOCAL GEMS ***

actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (3.0.0, 2.3.8)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.1.0)
fastthread (1.0.7)
gem_plugin (0.2.3)
mdalessio-dryopteris (0.1.2)
mongrel (1.1.5)
mongrel_cluster (1.0.5)
mysql (2.8.1)
nokogiri (1.4.3.1)
pauldix-feedzirra (0.0.18)
pauldix-sax-machine (0.0.14)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
taf2-curb (0.5.4.0)
xml-simple (1.0.12)

要启动服务器,我输入了 ruby​​ script/server

    anergroup@ubuntu:~/ruby/testapp$ ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.3 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...
Exiting
/home/anergroup/ruby/testapp/config/initializers/cookie_verification_secret.rb:7: undefined method `cookie_verifier_secret=' for ActionController::Base:Class (NoMethodError)
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load_without_new_constant_marking'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:550:in `load_application_initializers'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:549:in `each'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:549:in `load_application_initializers'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:167:in `process'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:112:in `send'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:112:in `run'
    from /home/anergroup/ruby/testapp/config/environment.rb:9
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:147:in `rails'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `call'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `listener'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `call'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load_without_new_constant_marking'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/vendor/rails/railties/lib/commands/servers/mongrel.rb:64
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/railties/lib/commands/server.rb:49
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/server:3

为什么我会收到此错误?我缺少任何配置吗?

另外,是否有适合新手的 Ruby on Rails Emacs 教程?

帮助

感谢高塔姆的

I am a newbie to rails. I just started learning Ubuntu, I am using version 10.04 especially to work on rails and use feedzirra in my college project.

I am getting the following error. Could you please help.

anergroup@ubuntu:~/ruby$ ruby -v
ruby 1.8.8dev (2010-10-01) [i686-linux]
anergroup@ubuntu:~/ruby$ rails -v
Rails 2.3.8

The list of gems I have are

anergroup@ubuntu:~/ruby$ sudo gem list

*** LOCAL GEMS ***

actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (3.0.0, 2.3.8)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.1.0)
fastthread (1.0.7)
gem_plugin (0.2.3)
mdalessio-dryopteris (0.1.2)
mongrel (1.1.5)
mongrel_cluster (1.0.5)
mysql (2.8.1)
nokogiri (1.4.3.1)
pauldix-feedzirra (0.0.18)
pauldix-sax-machine (0.0.14)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
taf2-curb (0.5.4.0)
xml-simple (1.0.12)

To start the server, I typed ruby script/server

    anergroup@ubuntu:~/ruby/testapp$ ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.3 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...
Exiting
/home/anergroup/ruby/testapp/config/initializers/cookie_verification_secret.rb:7: undefined method `cookie_verifier_secret=' for ActionController::Base:Class (NoMethodError)
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load_without_new_constant_marking'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:550:in `load_application_initializers'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:549:in `each'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:549:in `load_application_initializers'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:167:in `process'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:112:in `send'
    from /home/anergroup/ruby/testapp/config/../vendor/rails/railties/lib/initializer.rb:112:in `run'
    from /home/anergroup/ruby/testapp/config/environment.rb:9
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:147:in `rails'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `call'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `listener'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `call'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
    from /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load_without_new_constant_marking'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load'
    from /home/anergroup/ruby/testapp/vendor/rails/railties/lib/commands/servers/mongrel.rb:64
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/anergroup/ruby/testapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
    from /home/anergroup/ruby/testapp/vendor/rails/railties/lib/commands/server.rb:49
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/server:3

Why am I getting this error? Is there any config that I am missing?

Also, is there a good ruby on rails emacs tutorial for a newbie?

Thanks for the help

Gautam

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素食主义者 2024-10-02 23:29:35

看来您安装了 2 个版本的 Rails:2.3.8(如rails -v 中所示)和 2.3.3(如错误日志中所示)。在您的应用程序中强制使用较新的版本:

# config/environment.rb
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION

您可以使用 rvm 在它们之间切换。不过,最简单的方法是卸载 Ubuntu-rails 软件包并安装 Rails gem。

方法 cookie_verifier_secret= 已弃用,因此您可以安全地对其进行评论。

It seems that you have 2 versions of Rails installed: 2.3.8 (as in rails -v) and 2.3.3 (as in the error log). Enforce the newer one in your application:

# config/environment.rb
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION

You can user rvm to switch between them. The simplest thing to do, though, is to uninstall the Ubuntu-rails packages and install the rails gem.

The method cookie_verifier_secret= is deprecated, so you may comment them safely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文