1

当我尝试运行第一个应用程序时,我使用 RailsInstaller for Windows(我有 Windows 10)在 Rals 上安装了 Ruby,在 rails 服务器之后出现错误:

    C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.5-x86-mingw32/lib/nokogiri.rb:29:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.5-x86-mingw32/lib/nokogiri.rb:29:in `rescue in <top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.5-x86-mingw32/lib/nokogiri.rb:25:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/loofah-2.0.1/lib/loofah.rb:3:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/loofah-2.0.1/lib/loofah.rb:3:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.1/lib/rails-html-sanitizer.rb:2:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.1/lib/rails-html-sanitizer.rb:2:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/sanitize_helper.rb:3:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/sanitize_helper.rb:3:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/text_helper.rb:32:in `<module:TextHelper>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/text_helper.rb:29:in `<module:Helpers>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_tag_helper.rb:8:in `<module:ActionView>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_tag_helper.rb:6:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_helper.rb:4:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers/form_helper.rb:4:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers.rb:50:in `<module:Helpers>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers.rb:4:in `<module:ActionView>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action_view/helpers.rb:3:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/legacy_asset_tag_helper.rb:7:in `<module:LegacyAssetTagHelper>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/legacy_asset_tag_helper.rb:6:in `<module:Rails>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/legacy_asset_tag_helper.rb:4:in `<module:Sprockets>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/legacy_asset_tag_helper.rb:3:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:45:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:45:in `<module:Helper>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:7:in `<module:Rails>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:6:in `<module:Sprockets>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:5:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:6:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:6:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/rails/railtie.rb:2:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/rails/railtie.rb:2:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:11:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/rails.rb:11:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
    from C:/Sites/todo/config/application.rb:7:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

我该如何解决?错误“无法加载此类文件”的原因是什么?

4

1 回答 1

0

尝试$ gem install nokogiri在 Cygwin 或您在环境中使用的任何 CLI 中运行。这应该nokogiri为您安装 gem 并(希望)导致错误消失。

于 2017-02-27T23:53:12.253 回答