ローカル環境で、RailsアプリをHEROKUにデプロイできません。Precompiling assets failed
タイトルの通りです。
git push heroku master でエラーが解決できませんので教えていただきたいです。
railsチュートリアル1章を参考にして進めました。
AWSではデプロイできました。
下記がエラー内容です。
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to pure-taiga-35757.
remote:
To https://git.heroku.com/pure-taiga-35757.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pure-taiga-35757.git'
hayamishinjinoMacBook-Pro:task_app hayamishinji$ rake assets:precompile RAILS_ENV=production
rake aborted!
NameError: undefined local variable or method `config' for main:Object
/Users/hayamishinji/task_app/config/application.rb:6:in `<top (required)>'
/Users/hayamishinji/task_app/Rakefile:4:in `require_relative'
/Users/hayamishinji/task_app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
*試したこと
config/application.rbに config.assets.initialize_on_precompile = false
を追加
↓config/application.rb内のコード
require_relative 'boot'
require 'csv'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module TaskApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
config.time_zone = 'Asia/Tokyo'
config.assets.initialize_on_precompile = false
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
end
end
*環境
mac 10.14.6
ruby 2.5.0p0
Rails 5.2.3
heroku/7.26.2
お手数ですがお願いします。