質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

0回答

514閲覧

Herokuへデプロイしようとしたら「NoMethodError: undefined method `[]' for nil:NilClass」がでてデプロイできない

Yon-6

総合スコア0

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/04/08 02:43

前提・実現したいこと

Herokuへアプリをデプロイしたい。

プログラミング初心者で、初めて質問させていただきます。
Ruby on Railsでポートフォリオを登録するアプリを作成しました。開発環境では問題なく動作したので、いざHerokuを使ってデプロイしようとしたらエラーが出てしまい、デプロイできない状況です。

発生している問題・エラーメッセージ

remote: rake aborted! remote: NoMethodError: undefined method `[]' for nil:NilClass remote: /tmp/build_68ac7f61/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:278:in `sprockets_context' remote: /tmp/build_68ac7f61/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:124:in `asset_path' remote: /tmp/build_68ac7f61/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:137:in `asset_url' remote: /tmp/build_68ac7f61/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:155:in `image_url' remote: /tmp/build_68ac7f61/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_68ac7f61/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger' remote: /tmp/build_68ac7f61/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: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: f073f2076196b16739610384b3fde5102c76e741 remote: ! remote: ! We have detected that you have triggered a build from source code with version f073f2076196b16739610384b3fde5102c76e741 remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to gratitude-and-humors. remote: To https://git.heroku.com/gratitude-and-humors.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/gratitude-and-humors.git'

試したこと

エラー文「NoMethodError: undefined method []' for nil:NilClass」を調べてみました。
するとエラー文の下(今回の場合だと「/tmp/build_68ac7f61/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:278:in sprockets_context」)を見てみるとよいとありました。

この場合だとSASSのファイルがおかしいと思っていいのでしょうか?
まだMVC周りのファイルしか触ったことがなく、上記のファイルの格納場所などが分からず、手詰まりになっています。
よければお力を貸していただけないでしょうか?

よろしくお願いいたします。

補足情報(FW/ツールのバージョンなど)

ruby 2.6.5

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問