gpt4 book ai didi

ruby-on-rails - RoR 测试驱动开发 - `require' : cannot load such file -- nokogiri (LoadError)

转载 作者:行者123 更新时间:2023-12-04 05:22:42 25 4
gpt4 key购买 nike

我正在按照本教程开发一些 Ruby on Rails 应用程序。 http://ruby.railstutorial.org/chapters/static-pages#sec-TDD

我创建了 ..._spec.rb文件。

但是当我运行命令时 - bundle exec rspec spec/requests/static_pages_spec.rb
有错误 - require: cannot load such file -- nokogiri (LoadError).
任何人都可以帮助我吗?

完整的错误信息:

/home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/capybara-2.0.1/lib/capybara.rb:2:in `require': cannot load such file -- nokogiri (LoadError)
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/capybara-2.0.1/lib/capybara.rb:2:in `<top (required)>'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
from /home/karlis/workspace/sample_app/config/application.rb:13:in `<top (required)>'
from /home/karlis/workspace/sample_app/config/environment.rb:2:in `require'
from /home/karlis/workspace/sample_app/config/environment.rb:2:in `<top (required)>'
from /home/karlis/workspace/sample_app/spec/spec_helper.rb:3:in `require'
from /home/karlis/workspace/sample_app/spec/spec_helper.rb:3:in `<top (required)>'
from /home/karlis/workspace/sample_app/spec/requests/static_pages_spec.rb:1:in `require'
from /home/karlis/workspace/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.0/lib/rspec/core/configuration.rb:784:in `load'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.0/lib/rspec/core/configuration.rb:784:in `block in load_spec_files'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.0/lib/rspec/core/configuration.rb:784:in `each'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.0/lib/rspec/core/configuration.rb:784:in `load_spec_files'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.0/lib/rspec/core/runner.rb:69:in `run'
from /home/karlis/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.12.0/lib/rspec/core/runner.rb:8:in `block in autorun'

最佳答案

解决这个问题的最简单方法是手动更新 capybara 包,它解决了我的问题。
“捆绑更新 capybara ”

关于ruby-on-rails - RoR 测试驱动开发 - `require' : cannot load such file -- nokogiri (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13544821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com