Rails 101 push to Heroku failed - Precompiling assets failed

Precompiling assets failed

還找不到解答,卡關中…

8/3 20:30 Edit: Devise.secret_key was not set. Please add the following to your Devise initializer

加上要求的設定值 config.secret_key 之後成功 git push heroku ch08:master,然後 db:migrate 又卡關了 Orz

8/3 21:00 Edit:
Gemfile

1
2
gem 'pg'
gem 'rails_12factor', group: :production

config/database.yml

1
2
3
production:
adapter: postgresql
encoding: unicode

進 Heroku 砍掉原本的apps,重新 push 再下 heroku rails db:migrate 終於開站了~

https://infinite-stream-15278.herokuapp.com/

心得:如果卡關了不要一直重複push上去,修改完 git commit 之後試著重新開 heroku create 再run一次看看

Build log

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
Devise.secret_key was not set. Please add the following to your Devise initializer:

config.secret_key = 'XXXXXXXXXXXXXXXXXXXXXX'

Please ensure you restarted your application after installing Devise or setting the key.
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/rails/routes.rb:500:in `raise_no_secret_key'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/devise-4.4.3/lib/devise/rails/routes.rb:228:in `devise_for'
/tmp/build_45c05465d249d911aa27d16d3616706f/config/routes.rb:2:in `block in <main>'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.0/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.0/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.0/lib/action_dispatch/routing/route_set.rb:414:in `draw'
/tmp/build_45c05465d249d911aa27d16d3616706f/config/routes.rb:1:in `<main>'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `block in load'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `load'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/routes_reloader.rb:57:in `block in load_paths'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/routes_reloader.rb:57:in `each'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/routes_reloader.rb:57:in `load_paths'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/routes_reloader.rb:20:in `reload!'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/routes_reloader.rb:43:in `block in updater'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/file_update_checker.rb:83:in `execute'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/routes_reloader.rb:44:in `updater'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/routes_reloader.rb:33:in `execute_if_updated'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:130:in `block in <module:Finisher>'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
/tmp/build_45c05465d249d911aa27d16d3616706f/config/environment.rb:5:in `<main>'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/tmp/build_45c05465d249d911aa27d16d3616706f/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)

!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app.

! Push failed

heroku run rails db:migrate 失敗

1
2
3
4
5
6
7
8
9
  Kai ⮀ rails101-1 ⮀ ruby-2.5.1 ⮀ ⭠ ch08 ⮀ heroku run rails db:migrate --trace
Running rails db:migrate --trace on ⬢ pacific-ravine-13972... up, run.8280 (Free)
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rails aborted!
Gem::LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? sqlite3 is not part of the bundle. Add it to your Gemfile.
 Kai ⮀ rails101-1 ⮀ ruby-2.5.1 ⮀ ⭠ ch08 ⮀