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

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

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

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

Ruby on Rails

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

Q&A

1回答

2696閲覧

herokuへデプロイするときにNoMethodErrorが出るが、error場所がわからない

退会済みユーザー

退会済みユーザー

総合スコア0

Heroku

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

Ruby on Rails

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

0グッド

0クリップ

投稿2016/11/02 04:55

編集2022/01/12 10:55

ローカルの開発環境では、問題なく動作しているのですが、herokuへデプロイするときにエラーになります。
ターミナルをよく見て見ると以下の内容が書いてありましたが、そのerror文の解決法がわかりません。
ターミナルに書かれていたエラー内容

NoMethodError: undefined method `[]' for nil:NilClass

どこを確認したら良いかわからないのですが、
使用しているコントローラーの中身を以下に記します。
よろしければ回答をお願いします。

ruby

1/* 2 * This is a manifest file that'll be compiled into application.css, which will include all the files 3 * listed below. 4 * 5 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 * 8 * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 * compiled file so the styles you add here take precedence over styles defined in any styles 10 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 * file per style scope. 12 * 13 *= require_tree . 14 *= require_self 15 */ 16@import "bootstrap-sprockets"; 17@import "bootstrap"; 18 19 body { background: #9cb8b3; } 20 21h1 { 22 font: 600 1.5em/1 'Raleway', sans-serif; 23 /*font-size: 1rem;*/ 24 color: rgba(0,0,0,.5); 25 text-align: center; 26 text-transform: uppercase; 27 letter-spacing: .5em; 28 margin-top: 2rem; 29 width: 100%; 30} 31 32span, span:after { 33 font-weight: 900; 34 color: #efedce; 35 white-space: nowrap; 36 display: inline-block; 37 position: relative; 38 letter-spacing: .1em; 39 padding: .5em 0 .5em 0; 40} 41 42span { 43 font-size: 4em; 44 z-index: 100; 45 text-shadow: .04em .04em 0 #9cb8b3; 46} 47 48span:after { 49 content: attr(data-shadow-text); 50 color: rgba(0,0,0,.35); 51 text-shadow: none; 52 position: absolute; 53 left: .065em; 54 top: .0875em; 55 z-index: -1; 56 -webkit-mask-image: url(http://f.cl.ly/items/1t1C0W3y040g1J172r3h/mask.png); 57} 58@media screen and (max-width: 767px) { 59 span{ 60 font-size: 4rem; 61 } 62} 63.small{ 64 font-size: 0.8rem; 65} 66a:hover { 67 background-color: transparent; 68 text-decoration: none; 69 /*color: transparent;*/ 70} 71.circlePositioner { 72 margin-left: auto; 73 margin-right: auto; 74 /*width: 400px;*/ 75 text-align: center; 76 margin-top: 7%; 77 /*background-color: #fff;*/ 78} 79 80.mainCircle { 81 background-color: #0881AA; 82 width: 200px; 83 height: 200px; 84 border-radius: 50%; 85 display: inline-block; 86 overflow: hidden; 87 cursor: pointer; 88 opacity: .99; 89 transition: all 2s ease-in-out; 90 animation-iteration-count: infinite; 91} 92 93.spinningContainer { 94 background-color: #efefef; 95 height: 50px; 96 width: 100%; 97 margin-top: 75px; 98 position: relative; 99 animation: mymoveR 2s ease-in-out; 100 transform: scaleY(2); 101 transition: all 4s cubic-bezier(.18, 1.51, .85, 1.4); 102 animation-iteration-count: infinite; 103} 104 105.mainCircle:hover .overlay { 106 background-color: #7C9FAB; 107 transition: all .6s ease-in-out; 108 animation-iteration-count: infinite; 109} 110 111.mainCircle:hover .overlay p, .mainCircle:hover .small{ 112 color: white; 113 transition: all .6s ease-in-out; 114 animation-iteration-count: infinite; 115} 116 117.mainCircle:hover .spinningContainer { 118 -webkit-filter: blur(5px); 119 animation: mymove 2s cubic-bezier(1, .22, 1, .92), myscale 4s 2s ease-in-out; 120 animation-iteration-count: infinite; 121} 122 123@keyframes mymove { 124 from { 125 transform: rotate(0deg); 126 } 127 to { 128 transform: rotate(1080deg); 129 } 130} 131 132@keyframes mymoveR { 133 from { 134 transform: rotate(1080deg); 135 } 136 to { 137 transform: rotate(0deg); 138 } 139} 140 141@keyframes myscale { 142 0% { 143 transform: scaleY(2); 144 } 145 25% { 146 transform: scaleY(2.5); 147 } 148 50% { 149 transform: scaleY(3); 150 } 151 75% { 152 transform: scaleY(3.5); 153 } 154 100% { 155 transform: scaleY(4); 156 } 157} 158 159.mainCircle:hover { 160 background-color: white; 161 transition: all 1s ease-in-out; 162 transition-delay: .8s; 163} 164 165.leftContainer { 166 background-color: rgba(255, 255, 255, 0.79); 167 height: 50px; 168 width: 50px; 169 float: left; 170} 171 172.rightContainer { 173 background-color: rgba(255, 255, 255, 0.79); 174 height: 50px; 175 width: 50px; 176 float: right; 177} 178 179.overlay { 180 background-color: #46626B; 181 height: 190px; 182 width: 190px; 183 position: relative; 184 margin-left: auto; 185 margin-right: auto; 186 margin-top: -120px; 187 border-radius: 50%; 188 transition: all .3s ease-in-out; 189} 190 191.overlay p { 192 position: relative; 193 text-align: center; 194 margin-left: auto; 195 margin-right: auto; 196 margin-top: 39%; 197 display: inline-block; 198 font-family: 'Sigmar One', cursive; 199 font-size: 16pt; 200 transition: all .3s ease-in-out; 201} 202 203 204.container{ 205 width: 80%; 206 display: block; 207 margin-left: auto; 208 margin-right: auto; 209} 210.panel-heading{ 211 text-align: center; 212} 213table{ 214 text-align: center; 215 color: #0881AA; 216} 217td{ 218 text-align: left; 219 color: #000; 220} 221 222textarea { 223 width: 100%; 224 margin-top: 4rem; 225 border:solid 1px #ccc; 226 border-radius: 10px; 227 -moz-box-shadow: inset 1px 4px 9px -6px rgba(0,0,0,0.5); 228 -webkit-box-shadow: inset 1px 4px 9px -6px rgba(0, 0, 0, 0.5); 229 box-shadow: inset 1px 4px 9px -6px rgba(0,0,0,0.5); 230} 231 232.btn{ 233 width: 20%; 234 color: #fff; 235 /*background-color: rgba(255, 255, 255, 0.79);*/ 236 text-align: center; 237 display: block; 238 margin-left: auto; 239 margin-right: auto; 240} 241@media screen and (max-width: 767px) { 242 .container{ 243 width: 100%; 244 } 245 .btn{ 246 width: 50%; 247 } 248} 249

ちなみにターミナル上の画面はこのようになっています。

katsuwlan173150:hoikubox hajime$ git push heroku master Counting objects: 134, done. Delta compression using up to 4 threads. Compressing objects: 100% (122/122), done. Writing objects: 100% (134/134), 26.73 KiB | 0 bytes/s, done. Total 134 (delta 27), reused 0 (delta 0) remote: I, [2016-11-02T05:35:06.864085 #940] INFO -- : Writing /tmp/build_2eb7710262bd71ca3da40830d57d958d/public/assets/application-e5726d610429bff169907e5452fe956b758a808220d80062cc2c2cfd692f8da1.js.gz ~省略~ remote: Bundle completed (23.94s) remote: Cleaning up the bundler cache. remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: I, [2016-11-02T06:11:22.102661 #939] INFO -- : Writing /tmp/build_a2935a0b6c52cbfe5a31b000fd607b51/public/assets/application-a28559506691956cf975ecc0992d16f83c609962bca6c25154dab4926edd97a9.js remote: I, [2016-11-02T06:11:22.103275 #939] INFO -- : Writing /tmp/build_a2935a0b6c52cbfe5a31b000fd607b51/public/assets/application-a28559506691956cf975ecc0992d16f83c609962bca6c25154dab4926edd97a9.js.gz remote: rake aborted! remote: NoMethodError: undefined method `[]' for nil:NilClass remote: /tmp/build_a2935a0b6c52cbfe5a31b000fd607b51/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/sass_processor.rb:278:in `sprockets_context' remote: /tmp/build_a2935a0b6c52cbfe5a31b000fd607b51/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/sass_processor.rb:124:in `asset_path' remote: /tmp/build_a2935a0b6c52cbfe5a31b000fd607b51/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/sass_processor.rb:200:in `font_path' ~省略~ remote: Tasks: TOP => assets:precompile remote: (See full trace by running task with --trace) 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 toywonder-hoikubox. remote: To https://git.heroku.com/toywonder-hoikubox.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/toywonder-hoikubox.git'

RAILS_ENV=production bundle exec rake assets:precompileの結果です。

katsuwlan173150:hoikubox hajime$ RAILS_ENV=production bundle exec rake assets:precompile I, [2016-11-02T14:50:29.325031 #12495] INFO -- : Writing /Users/hajime/hoikubox/public/assets/application-e5726d610429bff169907e5452fe956b758a808220d80062cc2c2cfd692f8da1.js I, [2016-11-02T14:50:29.336553 #12495] INFO -- : Writing /Users/hajime/hoikubox/public/assets/application-e5726d610429bff169907e5452fe956b758a808220d80062cc2c2cfd692f8da1.js.gz rake aborted! NoMethodError: undefined method `[]' for nil:NilClass /Library/Ruby/Gems/2.0.0/gems/sprockets-3.7.0/lib/sprockets/sass_processor.rb:278:in `sprockets_context' /Library/Ruby/Gems/2.0.0/gems/sprockets-3.7.0/lib/sprockets/sass_processor.rb:124:in `asset_path' /Library/Ruby/Gems/2.0.0/gems/sprockets-3.7.0/lib/sprockets/sass_processor.rb:200:in `font_path' ~省略~ /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start' /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>' /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors' /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>' /usr/local/bin/bundle:23:in `load' /usr/local/bin/bundle:23:in `<main>' Tasks: TOP => assets:precompile (See full trace by running task with --trace)

RAILS_ENV=production bundle exec rake assets:precompileの結果

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

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

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

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

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

hana-da

2016/11/02 05:07

Errorメッセージは大盛りでお願いします。少なすぎます。
退会済みユーザー

退会済みユーザー

2016/11/02 05:41

ターミナルでのErrorを示しているであろう部分を載せました。他にも必要ば情報があればお知らせください。
hana-da

2016/11/02 05:44 編集

あああ。その時に出たのね。と、思いつつ。肝心なところが省略されているような気がします。
hana-da

2016/11/02 05:46

ちなみに `RAILS_ENV=production bundle exec rake assets:precompile` は成功するという事で大丈夫でしょうか?
退会済みユーザー

退会済みユーザー

2016/11/02 05:52

初心者でそのコマンドをしたことはなかったのですが、してみたところエラーとなっているようです。
hana-da

2016/11/02 05:55

残念ながらあなたの画面は見えないので出たエラーは貼ってもらわないとわからないのです。
退会済みユーザー

退会済みユーザー

2016/11/02 05:57

先ほど、貼りました。ご確認お願いします。
hana-da

2016/11/02 06:01

NoMethodError: undefined method `[]' for nil:NilClass の後は何も出ないのであれば `RAILS_ENV=production bundle exec rake --trace assets:precompile` でいっぱ出るとおもいます。
hana-da

2016/11/02 06:02

ちなみに画像を貼ると検索できなくて他の人のためにならないのでtextで貼った方が世の中のためになります。
退会済みユーザー

退会済みユーザー

2016/11/02 06:04

表示されている文はたくさんあるのですが、全て載せると文字制限に引っかかってしまうため画像にしました。制限いっぱいまでは、textで載せます。
退会済みユーザー

退会済みユーザー

2016/11/02 06:09

できる限りテキストでターミナルの実行結果を載せました。
hana-da

2016/11/02 08:01

そんな制限があるんですか!!ひどいですね。。。。とりあえずBoxesControllerは関係なさそうなのでapplication.css.scssを見てみたいです。
退会済みユーザー

退会済みユーザー

2016/11/02 09:21

10000次までという制限があります!application.cssをのせました。ご覧下さい。
guest

回答1

0

scss

1/* 2 * This is a manifest file that'll be compiled into application.css, which will include all the files 3 * listed below. 4 * 5 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 * 8 * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 * compiled file so the styles you add here take precedence over styles defined in any styles 10 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 * file per style scope. 12 * 13 *= require_tree . 14 *= require_self 15 */

scss

1*= require_tree . 2*= require_self

を消すとうまくいったりします?

投稿2016/11/02 09:41

hana-da

総合スコア1728

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

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

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

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問