前提・実現したいこと
Railsでローカル環境でアプリを作成し、
Herokuへpushする際にエラーが発生し、原因を探っております。
発生している問題・エラーメッセージ
エラーメッセージ remote: rake aborted! remote: NoMethodError: undefined method `[]' for nil:NilClass ### 該当のソースコード remote: rake aborted! remote: NoMethodError: undefined method `[]' for nil:NilClass remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:278:in `sprockets_context' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:124:in `asset_path' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:137:in `asset_url' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:155:in `image_url' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/tree/funcall.rb:151:in `block in _perform' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:108:in `block in with_function' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:135:in `with_frame' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:108:in `with_function' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/tree/funcall.rb:149:in `_perform' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/tree/node.rb:50:in `perform' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:398:in `visit_prop' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb:36:in `visit' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:158:in `block in visit' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:79:in `block in with_base' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:135:in `with_frame' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:79:in `with_base' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:158:in `visit' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:440:in `block (2 levels) in visit_rule' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:440:in `map' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:440:in `block in visit_rule' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:179:in `with_environment' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:438:in `visit_rule' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb:36:in `visit' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:158:in `block in visit' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:79:in `block in with_base' (中略) remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:67:in `block (3 levels) in define' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger' remote: /tmp/build_4fbf04da/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:66:in `block (2 levels) in define' remote: Tasks: TOP => assets:precompile remote: (See full trace by running task with --trace) remote: ! remote: ! Precompiling assets failed. ```Rails: ローカルリポジトリのmasterブランチにマージし、% git push heroku master後のターミナルの出力 [バージョン] ruby2.6.5 Rails6.0.0(アプリ作成時の指定バージョン) gem 3.0.3/heroku 7.47.2/git 2.24.3 ### 試したこと CSSのscssのファイルが適用されていないことが原因だと考え、app/assets/application.cssのファイル名をapplication.css.scssに変更して再度プッシュしましたが、うまくいきませんでした。また、上記該当のファイルは自分のPCのRailsアプリケーション上で確認することができない(作成していない)です。 参考: [RailsでアプリをHerokuにあげる時のエラー各種](https://qiita.com/pokohide/items/017afa5be3b7dc200a8d) [NoMethodError: undefined method `[]' for nil:NilClass when pushing to Heroku ](https://stackoverflow.com/questions/32939496/nomethoderror-undefined-method-for-nilnilclass-when-pushing-to-heroku) [nil:NilClassの「NoMethodError」への対処方法](https://www.ryotaku.com/entry/2019/02/18/231458) ### お願い 一人では解決が難しいためアドバイスを頂けると有難いです。
回答1件
あなたの回答
tips
プレビュー