1

How can I fix this error when trying to precompile assets?

command: bundle exec rake assets:precompile

Error:

rake aborted! LoadError: cannot load such file --
sitemap_generator/tasks
/Users/.../Documents/projects/.../...-.../Rakefile:5:in
`require'
/Users/.../Documents/projects/.../...-.../Rakefile:5:in
`<top (required)>'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_module.rb:28:in
`load'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/rake_module.rb:28:in
`load_rakefile'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:689:in
`raw_load_rakefile'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:94:in
`block in load_rakefile'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:176:in
`standard_exception_handling'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:93:in
`load_rakefile'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:77:in
`block in run'
/Users/pramod/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:176:in
`standard_exception_handling'
/Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/rake/application.rb:75:in
`run' /Users/.../.rvm/rubies/ruby-2.2.1/bin/rake:33:in `<main>'

My gemfile:

source 'https://rubygems.org'

gem 'haml-rails'
gem "font-awesome-rails"
gem 'font-awesome-sass', '~> 4.2.2'
gem 'bootstrap-sass', '~> 3.3.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
ruby '2.2.1'

gem 'sitemap-generator'
gem 'pg', '~> 0.15' #postgresql gem
# 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'
gem 'sprockets-rails', '2.3.3'

# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor', group: :production

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

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

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
Ernest
  • 8,701
  • 5
  • 40
  • 51
RPV
  • 397
  • 1
  • 5
  • 16

1 Answers1

1

You've included the wrong gem in your Gemfile. You're including the sitemap-generator gem, which is a small command-line generator. But your code is depending on the sitemap_generator gem, which is much more fully-featured. Change the dash to an underscore, and you should be good to go:

gem 'sitemap_generator'
Alex P
  • 5,942
  • 2
  • 23
  • 30
  • I will try in a bit, but want to highlight that using the current sitemap-generator syntax, works on my local machine but not heroku. I'll check your answer in abit – RPV Jan 13 '16 at 08:40
  • 1
    You probably have the correct gem installed on your local machine already, but Heroku always starts from scratch & just installs the gems listed in the Gemfile. – Alex P Jan 13 '16 at 17:18