Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在Hartl'中获取错误;“s教程运行”;bundle exec rspec spec/requests/static“页面规范rb”;_Ruby On Rails_Ruby_Testing - Fatal编程技术网

Ruby on rails 在Hartl'中获取错误;“s教程运行”;bundle exec rspec spec/requests/static“页面规范rb”;

Ruby on rails 在Hartl'中获取错误;“s教程运行”;bundle exec rspec spec/requests/static“页面规范rb”;,ruby-on-rails,ruby,testing,Ruby On Rails,Ruby,Testing,我正在从迈克尔·哈特尔的教程中学习Ruby。我正在一步一步地走,但这一步我过不了。当我输入“bundle exec rspec spec/requests/static_pages_spec.rb”时,我得到一个非常长的错误响应,而不是简单的“1个示例,0个失败”。我在静态页面目录中更改了必要的代码,我很自信代码是正确的,因为我只是简单地复制和粘贴。错误消息如下: /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/no

我正在从迈克尔·哈特尔的教程中学习Ruby。我正在一步一步地走,但这一步我过不了。当我输入“bundle exec rspec spec/requests/static_pages_spec.rb”时,我得到一个非常长的错误响应,而不是简单的“1个示例,0个失败”。我在静态页面目录中更改了必要的代码,我很自信代码是正确的,因为我只是简单地复制和粘贴。错误消息如下:

/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in `require': dlopen(/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /Users/marlon/.bundler/tmp/1219/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxml2/2.8.0/lib/libxml2.2.dylib (LoadError)
  Referenced from: /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle
  Reason: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0 - /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in `<top (required)>'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/capybara-1.1.2/lib/capybara.rb:2:in `require'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/capybara-1.1.2/lib/capybara.rb:2:in `<top (required)>'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /Users/marlon/rails_projects/sample_app/config/application.rb:7:in `<top (required)>'
    from /Users/marlon/rails_projects/sample_app/config/environment.rb:2:in `require'
    from /Users/marlon/rails_projects/sample_app/config/environment.rb:2:in `<top (required)>'
    from /Users/marlon/rails_projects/sample_app/spec/spec_helper.rb:3:in `require'
    from /Users/marlon/rails_projects/sample_app/spec/spec_helper.rb:3:in `<top (required)>'
    from /Users/marlon/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require'
    from /Users/marlon/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
    from /Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
dyn172-30-28-254:sample_app marlon$
/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in'require':dlopen(/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle,9):库未加载:/Users/marlon/.bundler/tmp/1219/gems/nokogiri-1.6.0/ports/nokogiri-1.6.6.0/lib-2.xml2/lib-2.xmlwin2
引用自:/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle
原因:库版本不兼容:nokogiri.bundle需要11.0.0或更高版本,但libxml2.2.dylib提供了10.0.0-/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in`'
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/capybara-1.1.2/lib/capybara.rb:2:in'require'
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/capybara-1.1.2/lib/capybara.rb:2:in`'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in'require'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in'block(2层)in require'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in'each'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in'block in require'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in'each'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in'require'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler.rb:132:in'require'
from/Users/marlon/rails\u projects/sample\u app/config/application.rb:7:in`'
来自/Users/marlon/rails\u projects/sample\u app/config/environment.rb:2:in'require'
来自/Users/marlon/rails\u projects/sample\u app/config/environment.rb:2:in`'
from/Users/marlon/rails\u projects/sample\u app/spec/spec\u helper.rb:3:in'require'
from/Users/marlon/rails\u projects/sample\u app/spec/spec\u helper.rb:3:in`'
来自/Users/marlon/rails\u projects/sample\u app/spec/requests/static\u pages\u spec.rb:1:in'require'
来自/Users/marlon/rails\u projects/sample\u app/spec/requests/static\u pages\u spec.rb:1:in`'
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in'load'
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:“加载规范文件中的块”
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in'map'
来自/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:“加载规范文件”中
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/command_-line.rb:22:在“运行”中
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in“run”
from/Users/marlon/.rvm/gems/ruby-1.9.2-p320/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in“自动运行中的块”
dyn172-30-28-254:马龙应用程序样本$

请让我知道我能做些什么来解决这个问题。我感谢所有的帮助,提前谢谢

您应该安装nokogiri依赖项:

brew install libxml2 --with-xml2-config
brew install libxslt

谢谢你的回复。当我尝试“sudo:apt-get:command-not-found”时,我得到了这个答案。我在视网膜MacBook Pro上使用了OSX Mountain Lion。我更新了答案。我不知道OSX,但我想应该可以。嘿,再次谢谢。我得到了“警告:libxml2-2.9.1已经安装”和“警告:libxslt-1.1.28已经安装”好的,我不知怎么地让它工作了。出于某种原因,我不得不重新安装水豚!