Nick Charney Kaye
Nick Charney Kaye

Reputation: 4391

Rails NameError (uninitialized constant Sprockets::Processor) with `rails-polymer` during `rake rails:update:bin`

I'm attempting to upgrade by application to use the new Rails 4 binstubs. Actually, it's a fresh Rails 4 project, but I had originally run bundle --binstubs and am now fixing it. Attempting:

bundle exec rake rails:update:bin --trace

I see:

rake aborted!
NameError: uninitialized constant Sprockets::Processor
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/polymer-rails-0.2.8/lib/polymer-rails/processors/components_processor.rb:5:in `<module:Rails>'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/polymer-rails-0.2.8/lib/polymer-rails/processors/components_processor.rb:4:in `<module:Polymer>'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/polymer-rails-0.2.8/lib/polymer-rails/processors/components_processor.rb:3:in `<top (required)>'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/polymer-rails-0.2.8/lib/polymer-rails.rb:4:in `require'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/polymer-rails-0.2.8/lib/polymer-rails.rb:4:in `<top (required)>'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:76:in `require'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:72:in `each'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:72:in `block in require'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:61:in `each'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.9.6/lib/bundler/runtime.rb:61:in `require'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.9.6/lib/bundler.rb:134:in `require'
/home/nick/Development/sh0/web/config/application.rb:7:in `<top (required)>'
/home/nick/Development/sh0/web/Rakefile:4:in `require'
/home/nick/Development/sh0/web/Rakefile:4:in `<top (required)>'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/nick/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/nick/.rbenv/versions/2.1.5/bin/rake:23:in `load'
/home/nick/.rbenv/versions/2.1.5/bin/rake:23:in `<main>'

Using rbenv with ruby-2.1.5.

Here's my Gemfile:

source 'https://rubygems.org'

# Bower components
source 'https://rails-assets.org' do
  gem 'rails-assets-polymer'
end

# Polymer-Rails
gem 'polymer-rails'
# Sprockets
gem 'sprockets'
gem 'sprockets-rails'
# Deployment
gem 'mina'
# MySQL for relational data
gem 'mysql2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
gem 'unicorn'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

Resolved!

rails-polymer at this version does not support sprockets >= 3.0.0.

I resolved the issue by first specifying gem 'sprockets', "< 3.0.0" in the Gemfile, and running bundle update sprockets.

See correct answer posted below

Upvotes: 2

Views: 1650

Answers (1)

Sean Hill
Sean Hill

Reputation: 15056

If you have sprockets >= 3.0.0 in your Gemfile.lock, then the issue is that polymer-rails is not compatible with it. They have updated the repo to limit the sprockets versions, but the new version of the gem might not have been release, or you're using an older version of the gem.

https://github.com/alchapone/polymer-rails/commit/745802f9eebba41c8f92c5ea6ba2060178d689ab

Upvotes: 6

Related Questions