【问题标题】:running rails server gives error can not load such a file -- nokogiri/nokogiri运行 rails 服务器出现错误无法加载这样的文件 -- nokogiri/nokogiri
【发布时间】:2015-11-27 04:40:54
【问题描述】:

我是 ROR 的新手当我想运行 rails 时,它给了我上面的错误,我已经安装了 gem nokogiri 和 bundle,但仍然存在同样的问题。我使用 Windows 7。我使用 ruby​​ 版本 2.2.2 和 rails 4.2.4

   C:\sites\simple_cms>rails s
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-       mingw32/lib/nokogiri
 .rb:29:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32
/lib/nokogiri.rb:29:in `rescue in <top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32
/lib/nokogiri.rb:25:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.3/lib/loofah.rb:3
:in `require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.3/lib/loofah.rb:3
:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/l
ib/rails-html-sanitizer.rb:2:in `require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/l
ib/rails-html-sanitizer.rb:2:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
view/helpers/sanitize_helper.rb:3:in `require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
 view/helpers/sanitize_helper.rb:3:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
 view/helpers/text_helper.rb:32:in `<module:TextHelper>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
  view/helpers/text_helper.rb:29:in `<module:Helpers>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
 view/helpers/text_helper.rb:6:in `<module:ActionView>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
 view/helpers/text_helper.rb:4:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
 view/helpers/form_tag_helper.rb:18:in `<module:FormTagHelper>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
  view/helpers/form_tag_helper.rb:14:in `<module:Helpers>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
   view/helpers/form_tag_helper.rb:8:in `<module:ActionView>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
   view/helpers/form_tag_helper.rb:6:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
  view/helpers/form_helper.rb:4:in `require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_
    view/helpers/form_helper.rb:4:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.4/lib/action_

    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

【问题讨论】:

  • 您使用的是哪个版本的 Ruby?
  • @AtulKhanduri Ruby 2.2.2

标签: ruby-on-rails ruby database ruby-on-rails-4


【解决方案1】:

Nokogiri 不支持 Windows 上的 Ruby 2.2。

请参阅this 答案。

也请查看this 以获得更多帮助。

【讨论】:

  • 哈哈,这就是我正在输入的内容,这就是我要求 Ruby 版本的原因.. :D
  • 总是乐于提供帮助。 :)
猜你喜欢
  • 2015-05-14
  • 2015-05-15
  • 1970-01-01
  • 2021-07-08
  • 1970-01-01
  • 2012-05-15
  • 2020-12-07
  • 2021-06-11
相关资源
最近更新 更多