尝试连接到 Rails 服务器时出现 Nokogiri Gem 错误



我想运行服务器,以便我可以在本地主机上检查我的站点:3000

我收到一个错误,指出我的 Nokogiri 宝石有问题,这是我的终端:

C:sitesMoovit>rails server
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/act
ive_support/dependencies.rb:239:in `require': 127: The specified procedure could
 not be found.   - Init_nokogiri (LoadError)
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/
lib/nokogiri/1.9/nokogiri.so
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4
-x86-mingw32/lib/nokogiri/nokogiri.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4
-x86-mingw32/lib/nokogiri.rb:13:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mechanize-1.0.
0/lib/mechanize.rb:9:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler.rb:132:in `require'
        from C:/sites/Moovit/config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:28:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:28:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:27:in `tap'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:27:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'
C:sitesMoovit>sudo gem update -system
'sudo' is not recognized as an internal or external command,
operable program or batch file.
C:sitesMoovit>gem update -system
Updating installed gems
Nothing to update
C:sitesMoovit>rails s
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/act
ive_support/dependencies.rb:239:in `require': 127: The specified procedure could
 not be found.   - Init_nokogiri (LoadError)
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/
lib/nokogiri/1.9/nokogiri.so
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4
-x86-mingw32/lib/nokogiri/nokogiri.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4
-x86-mingw32/lib/nokogiri.rb:13:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mechanize-1.0.
0/lib/mechanize.rb:9:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler.rb:132:in `require'
        from C:/sites/Moovit/config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:28:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:28:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:27:in `tap'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:27:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'
C:sitesMoovit>nokogiri -v
# Nokogiri (1.6.1)
    ---
    warnings: []
    nokogiri: 1.6.1
    ruby:
      version: 1.9.3
      platform: i386-mingw32
      description: ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
      engine: ruby
    libxml:
      binding: extension
      source: system
      compiled: 2.8.0
      loaded: 2.8.0
C:sitesMoovit> yum install libxml libxml-devel libxslt libxslt-devel
'yum' is not recognized as an internal or external command,
operable program or batch file.
C:sitesMoovit>install libxml libxml-devel libxslt libxslt-devel
install: target `libxslt-devel' is not a directory
C:sitesMoovit>install libxml
install: missing destination file operand after `libxml'
Try `install --help' for more information.
C:sitesMoovit>gem install nokogiri
Successfully installed nokogiri-1.6.1-x86-mingw32
1 gem installed
Installing ri documentation for nokogiri-1.6.1-x86-mingw32...
Installing RDoc documentation for nokogiri-1.6.1-x86-mingw32...
C:sitesMoovit>Rails s
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/act
ive_support/dependencies.rb:239:in `require': 127: The specified procedure could
 not be found.   - Init_nokogiri (LoadError)
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/
lib/nokogiri/1.9/nokogiri.so
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4
-x86-mingw32/lib/nokogiri/nokogiri.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4
-x86-mingw32/lib/nokogiri.rb:13:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.0.6/lib/active_support/dependencies.rb:239:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mechanize-1.0.
0/lib/mechanize.rb:9:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/
lib/bundler.rb:132:in `require'
        from C:/sites/Moovit/config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:28:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:28:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:27:in `tap'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.0.6
/lib/rails/commands.rb:27:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

请帮我找到解决方案,我应该怎么做才能使服务器运行?谢谢

根据这个 Github 问题,这是 1.4.4

版本的已知问题,并在 1.4.4.1 中修复。

查看您上面发布的控制台跟踪,我看到您最终安装了最新版本的 nokogiri (1.6.1),但您的 Gemfile 中可能有一些 gem 专门寻找版本 1.4.4,因此它没有找到更新的版本。我建议手动删除旧版本(gem uninstall nokogiri --version=1.4.4),然后查看 1.6.1 是否有效。

需要注意的是:您使用的是旧版本的Rails,可能还有一些较旧的宝石。任何寻找nokogiri 1.4.4的东西都可能无法与1.6.1一起使用,但值得一试。如果您仍有问题,请使用您的 Gemfile 更新问题,我们可以从那里开始工作。

最新更新