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

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

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

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

Q&A

解決済

1回答

175閲覧

railstutorial11章のデプロイがうまくいきません

shumbow

総合スコア35

Ruby on Rails 5

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

0グッド

0クリップ

投稿2019/05/11 19:30

編集2019/05/11 19:39

railstutorialをベースにしてオリジナルのアプリを作っているのですが、11章の終わりでデプロイする時にエラーが出てしまいました。

$git push heroku master Enumerating objects: 180, done. Counting objects: 100% (180/180), done. Delta compression using up to 8 threads Compressing objects: 100% (133/133), done. Writing objects: 100% (136/136), 17.70 KiB | 1.61 MiB/s, done. Total 136 (delta 79), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.5.3 remote: -----> Installing dependencies using bundler 2.0.1 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. remote: Fetching gem metadata from https://rubygems.org/............ remote: Using rake 12.3.2 remote: Using concurrent-ruby 1.1.5 remote: Using minitest 5.11.3 remote: Using thread_safe 0.3.6 remote: Using builder 3.2.3 remote: Using erubi 1.8.0 remote: Using mini_portile2 2.4.0 remote: Using crass 1.0.4 remote: Using rack 2.0.7 remote: Using nio4r 2.3.1 remote: Using websocket-extensions 0.1.3 remote: Using mini_mime 1.0.1 remote: Using arel 8.0.0 remote: Using execjs 2.7.0 remote: Using bcrypt 3.1.12 remote: Using popper_js 1.14.5 remote: Using method_source 0.9.2 remote: Using thor 0.20.3 remote: Using ffi 1.10.0 remote: Using tilt 2.0.9 remote: Using bundler 2.0.1 remote: Using coffee-script-source 1.12.2 remote: Using multi_json 1.13.1 remote: Using pg 1.1.4 remote: Using puma 3.12.1 remote: Using rb-fsevent 0.10.3 remote: Using turbolinks-source 5.2.0 remote: Fetching will_paginate 3.1.7 remote: Using i18n 1.6.0 remote: Using tzinfo 1.2.5 remote: Using nokogiri 1.10.2 remote: Using rack-test 1.1.0 remote: Using websocket-driver 0.6.5 remote: Using sprockets 3.7.2 remote: Using mail 2.7.1 remote: Using autoprefixer-rails 9.5.1 remote: Using uglifier 4.1.20 remote: Using sassc 2.0.1 remote: Using rb-inotify 0.10.0 remote: Using coffee-script 2.4.1 remote: Using turbolinks 5.2.0 remote: Fetching faker 1.9.3 remote: Using activesupport 5.1.7 remote: Using loofah 2.2.3 remote: Fetching mail-iso-2022-jp 1.1.5 remote: Installing will_paginate 3.1.7 remote: Installing faker 1.9.3 remote: Using sass-listen 4.0.0 remote: Using rails-dom-testing 2.0.3 remote: Using globalid 0.4.2 remote: Using activemodel 5.1.7 remote: Using jbuilder 2.8.0 remote: Using rails-html-sanitizer 1.0.4 remote: Using sass 3.7.4 remote: Installing mail-iso-2022-jp 1.1.5 remote: Using activejob 5.1.7 remote: Using activerecord 5.1.7 remote: Using actionview 5.1.7 remote: Using actionpack 5.1.7 remote: Using actioncable 5.1.7 remote: Using actionmailer 5.1.7 remote: Using railties 5.1.7 remote: Using sprockets-rails 3.2.1 remote: Using coffee-rails 4.2.2 remote: Using jquery-rails 4.3.3 remote: Fetching rails-i18n 5.1.3 remote: Using sassc-rails 2.1.0 remote: Using rails 5.1.7 remote: Using sass-rails 5.0.7 remote: Using bootstrap 4.3.1 remote: Installing rails-i18n 5.1.3 remote: Bundle complete! 27 Gemfile dependencies, 67 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into `./vendor/bundle` remote: Bundle completed (4.50s) remote: Cleaning up the bundler cache. remote: -----> Installing node-v10.14.1-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: rake aborted! remote: SyntaxError: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/config/environments/production.rb:82: syntax error, unexpected tIDENTIFIER, expecting '}' remote: config.i18n.fallbacks = true remote: ^~~~~~ remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `block in require' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in `load_dependency' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/engine.rb:599:in `each' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/engine.rb:599:in `block in <class:Engine>' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `instance_exec' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `run' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/initializable.rb:59:in `block in run_initializers' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/initializable.rb:48:in `each' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/initializable.rb:48:in `tsort_each_child' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/initializable.rb:58:in `run_initializers' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/application.rb:353:in `initialize!' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/config/environment.rb:5:in `<top (required)>' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/application.rb:329:in `require' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/application.rb:329:in `require_environment!' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/railties-5.1.7/lib/rails/application.rb:445:in `block in run_tasks_blocks' remote: /tmp/build_9dc0a9f1d54a5056630423a7124fefe1/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_9dc0a9f1d54a5056630423a7124fefe1/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/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 xxxxxx remote: To https://git.heroku.com/xxxx ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/xxxxx

考えられる原因

herokuのクレジットカードの登録をしている時に、ついでに気になって、使っていなさそうなsshキーを消そうと思って、3つあるうちの2つを消してしまいました。これって関係あるのでしょうか、、、

さらにやらかしてしまったこと

assetのコンパイルがエラーを起こしているので、それ関係で対処法を探していて、Heroku の assets:precompile で エラーが起きたときの調査方法の$bundle exec rake assets:precompile RAILS_ENV=productionをよくわけもわからないまま(おそらくアプリに変化は及ぼさないだろうと思って)実行してしまったところ、publicディレクトリにassetsディレクトリという、おそらくコンパイルした後のbootstrap関連のファイルなどができてしまったので、git mergeしたばかりだったので、git reset --hard HEADをしたのですが、なぜかもどってくれません、、、関連ファイルなどが残ってしまっても怖いので、どなたか上のコマンドを取り消す方法などご存知ないでしょうか?デプロイ関係が疎いので、詳しい方どうかご教授ください。。

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

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

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

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

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

guest

回答1

0

自己解決

よく見たらconfig/environment/production.rbの82行目に } が抜けていました。
またpublicにプリコンパイルでできてしまったassetsフォルダーは、$rails assets:clobber RAILS_ENV=productionで戻すことができました。

投稿2019/05/11 20:15

shumbow

総合スコア35

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問