无法为heroku预编译资产

时间:2016-01-12 17:42:06

标签: ruby-on-rails heroku precompile-assets

如何在尝试预编译资产时修复此错误?

命令:bundle exec rake assets:precompile

错误:

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>'

我的宝石文件:

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

1 个答案:

答案 0 :(得分:1)

您在Gemfile中包含了错误的宝石。您包括the sitemap-generator gem,这是一个小型命令行生成器。但是,您的代码依赖于the sitemap_generator gem,后者功能更全面。将短划线更改为下划线,您应该好好去:

gem 'sitemap_generator'