【问题标题】:ruby / rails `rescue in debug=': (RuntimeError) [duplicate]ruby / rails `rescue in debug=': (RuntimeError) [重复]
【发布时间】:2012-11-07 06:33:07
【问题描述】:

可能重复:
ruby_threadptr_data_type error

我是 Ruby / Rails 新手,在 Ubuntu 12.04 上设置环境时遇到问题。我正在使用 rbenv(不是 rvm)。这是我安装 ruby​​ 的方式:

# clone rbenv and the ruby-build plugin
git clone git://github.com/sstephenson/rbenv.git .rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

# initialize rbenv
export PATH=~/.rbenv/bin:$PATH
rbenv init -

# install ruby 1.9.2
rbenv install 1.9.2-p320
rbenv rehash

# change ruby version to 1.9.2
rbenv global 1.9.2-p320

我正在尝试运行以下 hello-world 应用程序: https://github.com/renderedtext/base-app

我正在运行网站上推荐的命令

bundle install
bundle exec rake db:setup db:test:prepare
bundle exec rake spec
bundle exec rake cucumber

它在bundle exec rake spec 失败并出现以下错误:

NOTICE:  CREATE TABLE will create implicit sequence "roles_id_seq" for serial column "roles.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "roles_pkey" for table "roles"
NOTICE:  CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"
/home/ubuntu/.rbenv/versions/1.9.2-p320/bin/ruby -S rspec ./spec/models/role_spec.rb ./spec/models/user_spec.rb ./spec/controllers/admin/base_controller_spec.rb ./spec/controllers/admin/users_controller_spec.rb ./spec/controllers/pages_controller_spec.rb ./spec/helpers/pages_helper_spec.rb
No DRb server is running. Running in local process instead ...
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:422:in `rescue in debug=':  (RuntimeError)
**************************************************
/var/lib/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_threadptr_data_type - /var/lib/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so

If you have it installed as a ruby gem, then you need to either require
'rubygems' or configure the RUBYOPT environment variable with the value
'rubygems'.

/var/lib/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `require'
/var/lib/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `require'
/var/lib/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:408:in `require'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:408:in `debug='
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration_options.rb:20:in `block in configure'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration_options.rb:19:in `each'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration_options.rb:19:in `configure'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:21:in `run'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:66:in `rescue in run'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:62:in `run'
/var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'
**************************************************
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:407:in `debug='
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration_options.rb:20:in `block in configure'
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration_options.rb:19:in `each'
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/configuration_options.rb:19:in `configure'
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:21:in `run'
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:66:in `rescue in run'
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:62:in `run'
    from /var/lib/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!
/home/ubuntu/.rbenv/versions/1.9.2-p320/bin/ruby -S rspec ./spec/models/role_spec.rb ./spec/models/user_spec.rb ./spec/controllers/admin/base_controller_spec.rb ./spec/controllers/admin/users_controller_spec.rb ./spec/controllers/pages_controller_spec.rb ./spec/helpers/pages_helper_spec.rb failed

Tasks: TOP => spec
(See full trace by running task with --trace)

同样重要的是要注意服务器似乎已经安装了 ruby​​ 1.9.1(可能使用 apt-get),但我想使用 1.9.2,这就是我安装 rbenv 的原因。

附带说明一下,我也尝试过在 1.9.3 中使用 rbenv 并得到相同的错误。

我尝试研究并应用其他堆栈溢出问题(如ruby_threadptr_data_type error)的答案,但导致了段错误。此外,在我的研究中,大多数答案似乎都与 rvm 和 1.9.3 相关……而不是 rbenv 和 1.9.2

请帮忙!

【问题讨论】:

  • 所以这确实成功了......但现在我想知道 - 该项目是由 16 个人分叉的......这个问题是 linux 特有的吗?还是该项目对所有人都不利?
  • ruby-debug 已经过时了,我相信从长远来看使用调试器是一个更好的解决方案。

标签: ruby-on-rails ruby rbenv


【解决方案1】:

rspec 似乎无法加载 ruby​​-debug。 Here's where it's happening 如果你好奇的话。您可能忘记在您的 spec_helper.rb 中添加 require 'rubygems'。这样做并让我知道这是否解决了问题。

更新:

尝试从 Gemfile 中删除 gem 'ruby-debug19' 并将其替换为 gem 'debugger' 然后在控制台中运行 bundle 并重试。 ruby-debug19 没有维护,所以这可能是原因。 More about debugger。还有 ruby​​-debug19 安装说明的链接(如果你觉得幸运的话)。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-05-10
  • 2011-02-28
  • 1970-01-01
  • 1970-01-01
  • 2019-07-10
  • 2019-06-06
  • 1970-01-01
相关资源
最近更新 更多