尝试加载gem'sass-rails'时出错。 (捆扎机:: GemRequireError)

时间:2016-05-01 04:28:21

标签: ruby-on-rails

启动rails服务器时出错。

C:\Ruby22-x64\WebAppRails>rails s C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'sass-rails'. (Bundler::GemRequireError)
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
        from C:/Ruby22-x64/WebAppRails/config/application.rb:7:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

以下是我正在使用的宝石:

C:\Ruby22-x64\WebAppRails>bundle show

捆绑包含的宝石:

  • actionmailer(4.2.6)
  • actionpack(4.2.6)
  • actionview(4.2.6)
  • activejob(4.2.6)
  • activemodel(4.2.6)
  • activerecord(4.2.6)
  • activesupport(4.2.6)
  • arel(6.0.3)
  • binding_of_caller(0.7.2)
  • builder(3.2.2)
  • bundler(1.11.2)
  • byebug(8.2.5)
  • coffee-rails(4.1.1)
  • coffee-script(2.4.1)
  • coffee-script-source(1.10.0)
  • concurrent-ruby(1.0.1)
  • debug_inspector(0.0.2)
  • erubis(2.7.0)
  • execjs(2.6.0)
  • globalid(0.3.6)
  • i18n(0.7.0)
  • jbuilder(2.4.1)
  • jquery-rails(4.1.1)
  • json(1.8.3)
  • 丝瓜(2.0.3)
  • mail(2.6.4)
  • mime-types(3.0)
  • mime-types-data(3.2016.0221)
  • mini_portile2(2.0.0)
  • minitest(5.8.4)
  • multi_json(1.11.3)
  • nokogiri(1.6.7.2)
  • rack(1.6.4)
  • rack-test(0.6.3)
  • rails(4.2.6)
  • rails-deprecated_sanitizer(1.0.3)
  • rails-dom-testing(1.0.7)
  • rails-html-sanitizer(1.0.3)
  • railties(4.2.6)
  • rake(11.1.2)
  • rdoc(4.2.2)
  • sass(3.4.22)
  • sass-rails(5.0.4)
  • sdoc(0.4.1)
  • 链轮(3.6.0)
  • sprockets-rails(3.0.4)
  • sqlite3(1.3.11)
  • thor(0.19.1)
  • thread_safe(0.3.5)
  • 倾斜(2.0.2)
  • turbolinks(2.5.3)
  • tzinfo(1.2.2)
  • tzinfo-data(1.2016.4)
  • uglifier(3.0.0)
  • web-console(2.3.0)

gem版本是2.4.5.1,ruby版本是2.2.4

我需要做些什么来解决这个问题?

2 个答案:

答案 0 :(得分:1)

将以下内容添加到您的Gemfile:

union

并且

gem 'sass-rails', '>= 5.0.3'

答案 1 :(得分:0)

当我为我刚刚克隆的Rails应用程序安装适当版本的Ruby时,我的问题得到了解决 - 我安装了2.4.1但我的应用程序需要2.3。