0

我在我的 ruby​​ (2.2.2) on rails (4.2.3) 应用程序中使用 autoprefixer 但似乎有一个 GemRequireError 并且我不知道为什么或如何去修复它......谁能给我一些指针?

我运行 bundle 并安装 autoprefixer-rails 6.3.3.1 没有问题,但是当我尝试使用运行 Web 时rails s出现错误。

错误:

user@ubuntu:~/development/myweb$ rails s
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'autoprefixer-rails'. (Bundler::GemRequireError)
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `each'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `block in require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:61:in `each'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:61:in `require'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:99:in `require'
    from /home/user/development/myweb-web/config/application.rb:7:in `<top (required)>'
    from /home/user/.rvm/gems/ruby-2.2.2@myweb/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/user/.rvm/gems/ruby-2.2.2@myweb/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/user/.rvm/gems/ruby-2.2.2@myweb/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/user/.rvm/gems/ruby-2.2.2@myweb/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/user/.rvm/gems/ruby-2.2.2@myweb/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/user/.rvm/gems/ruby-2.2.2@myweb/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

我的 /home/user/development/myweb-web/config/application.rb:7

Bundler.require(*Rails.groups)

我的宝石文件:

source 'https://rubygems.org'

gem 'rails', '4.2.3'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'activerecord-postgis-adapter'

# usage https://github.com/mbleigh/acts-as-taggable-on
gem 'acts-as-taggable-on', '~> 3.4'
gem 'acts_as_votable', '~> 0.10.0'
gem 'rmagick'
gem 'paperclip'
gem 'jquery-rails'
gem 'jquery-fileupload-rails', '~> 0.4.6'
gem 'jbuilder', '~> 2.0'

# security
gem 'omniauth'
gem 'omniauth-facebook'
gem "omniauth-islykill"
gem 'omniauth-twitter'
gem "omniauth-google-oauth2"

gem 'paperclip-meta'
gem 'photoswipe-rails'

gem "autoprefixer-rails"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
    gem 'sass-rails'
    gem 'coffee-rails'

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes
    # gem 'therubyracer', :platforms => :ruby

    gem 'uglifier', '>= 1.0.3'
end

group :development, :test do
    gem 'rails-perftest'
    gem 'ruby-prof'
    gem 'capybara'
end    
4

3 回答 3

0

在我的项目中 - 我只是在 Gemfile.lock 中更改了一行:从 hashie (3.5.2) 到 hashie (3.4.6)

于 2017-02-11T15:19:32.547 回答
0

我不完全确定为什么,但我跑gem pristine --all了,问题就消失了。所以,我猜有一些缓存问题,与autoprefixer-rails产生了一些冲突或歧义,但不是 gem 本身。

于 2016-06-17T23:16:42.610 回答
0

我将 therubyracer 更新到 0.12.3 以兼容 Ruby 2.4

bundle update therubyracer

于 2018-09-27T14:55:21.910 回答