

便利だと思い `rails_admin` をインストールしましたが、それ以降Herokuにpushしようとすると、  
タイトルのエラーが出るようになってしまいました。

`localhost:3000` でのRailsAdminの画面は正常に表示されております。  
(`localhost:3000/rails_admin` でアクセスできるように設定しています)

インストール時の手順は以下の通りで、エラーは出ませんでした。

  * Gemfileにgem 'rails_admin'を追加
  * `bundle install` を実行
  * `rails g rails_admin:install` を実行

また、単体で `rake assets:precompile` を実行した場合もエラーは出ません。

一度rails_admin自体を削除してみようと思い、以下を実行しましたが、エラー内容は全く変わりませんでした。

  * Gemfileから消去後に `bundle install`
  * config/initializers/rails_admin.rbファイルを消去 
  * routes.rbからrails_adminについて書かれた行を消去 
  * ターミナル再起動

プロジェクト内を検索してもRailsAdminは存在してないのに、このようなエラーが出ることも不思議です。どこに残っているんでしょうか。

* * *

**config/environments/production.rb**

[code]

    Rails.application.configure do
    ...
      config.assets.initialize_on_precompile = false
    ...
    end
    
[/code]

**エラーメッセージ**

[code]

       ・・・・・・
        remote: -----> Installing node-v10.15.3-linux-x64
        remote: -----> Detecting rake tasks
        remote: -----> Preparing app for Rails asset pipeline
            remote:        Running: rake assets:precompile
            remote:        rake aborted!
            remote:        NameError: uninitialized constant RailsAdmin
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/config/initializers/rails_admin.rb:1:in `<top (required)>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:657:in `block in load_config_initializer'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:170:in `instrument'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:656:in `load_config_initializer'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `each'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `block in <class:Engine>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/config/environment.rb:5:in `<top (required)>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
            remote:        
            remote:        Caused by:
            remote:        NameError: uninitialized constant RailsAdmin
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/config/initializers/rails_admin.rb:1:in `<top (required)>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:657:in `block in load_config_initializer'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:170:in `instrument'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:656:in `load_config_initializer'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `each'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `block in <class:Engine>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/config/environment.rb:5:in `<top (required)>'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
            remote:        /tmp/build_c2ae8846056c84a4ee0f6bc61a2fc8b4/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
            remote:        Tasks: TOP => environment
            remote:        (See full trace by running task with --trace)
            remote: 
            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 komo-service.
            remote: 
            To https://git.heroku.com/komo-service.git
             ! [remote rejected] master -> master (pre-receive hook declined)
            error: failed to push some refs to 'https://git.heroku.com/komo-service.git'
    
[/code]


CC BY-SA 4.0
2019-10-14T11:23:38.940
59698
2020-06-23T06:50:21.570
2019-10-16T01:42:51.533
3060
35636
question
ruby-on-rails heroku
RailsAdmin が削除できずに Precompiling assets failed エラーが発生する


自分も同じ問題にぶつかりましたが、各コード・ファイルを削除してから`bundle
install`してpushするとdeployできました。ちなみにGemfileの方はローカル開発時に以下の部分に記述していました。

[code]

    group :development, :test do
       # gem 'rails_admin' ←ここを削除した
    end
    
[/code]

Gemfile以外のコードやファイル以外も削除してから`bundle
install`したので、もしかすると全部削除してからしないと駄目とかありえるかもですね。

結構ググったのですが、海外のサイトでも同様のファイルを削除してくらいしか回答されてませんでした。


CC BY-SA 4.0
2020-06-23T06:50:21.570
67920
2020-06-23T06:50:21.570
32641
59698
answer