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

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

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

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Q&A

解決済

1回答

972閲覧

【railsチュートリアル】git push herokuをした際のCould not detect rake tasksについて

ayachika

総合スコア36

Ruby on Rails 5

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

0グッド

0クリップ

投稿2018/08/16 11:04

前提・実現したいこと

現在rails チュートリアル第5章を進めているRubyonrails初心者です。
5章の最後にgit push herokuを行うのですが、その際下記のエラーが出てしまいました。

チュートリアルを進める際に、途中で個人的にコードを加えたりしていない・今までgit push herokuは問題なく行えていたため、なぜこのようなことが起こるかさっぱりわかりません。

エラー文をネットで検索しましたが、似たような質問がなかったため、お答えいただけると大変ありがたく存じます。

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

エラーメッセージは下記のとおりです。

$ git push heroku Counting objects: 72, done. Compressing objects: 100% (70/70), done. Writing objects: 100% (72/72), 187.26 KiB | 9.86 MiB/s, done. Total 72 (delta 33), 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.4.4 remote: -----> Installing dependencies using bundler 1.15.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Your Gemfile lists the gem rails (= 5.1.4) more than once. remote: You should probably keep only one of them. remote: While it's not a problem now, it could cause errors if you change the version of one of them later. remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. remote: Fetching gem metadata from https://rubygems.org/......... remote: Fetching version metadata from https://rubygems.org/.. remote: Fetching dependency metadata from https://rubygems.org/. remote: Using rake 12.3.1 remote: Using concurrent-ruby 1.0.5 remote: Using minitest 5.11.3 remote: Using thread_safe 0.3.6 remote: Using builder 3.2.3 remote: Using erubi 1.7.1 remote: Using mini_portile2 2.3.0 remote: Using crass 1.0.4 remote: Using rack 2.0.5 remote: Using nio4r 2.3.1 remote: Using websocket-extensions 0.1.3 remote: Using mini_mime 1.0.0 remote: Using arel 8.0.0 remote: Using execjs 2.7.0 remote: Using rb-fsevent 0.10.3 remote: Using ffi 1.9.25 remote: Using bundler 1.15.2 remote: Using coffee-script-source 1.12.2 remote: Using method_source 0.9.0 remote: Using thor 0.20.0 remote: Using multi_json 1.13.1 remote: Using pg 0.20.0 remote: Using puma 3.9.1 remote: Using tilt 2.0.8 remote: Using turbolinks-source 5.1.0 remote: Using tzinfo 1.2.5 remote: Using nokogiri 1.8.4 remote: Using i18n 0.9.5 remote: Using rack-test 1.1.0 remote: Using sprockets 3.7.2 remote: Using websocket-driver 0.6.5 remote: Using mail 2.7.0 remote: Fetching autoprefixer-rails 9.1.1 remote: Using uglifier 3.2.0 remote: Using rb-inotify 0.9.10 remote: Using coffee-script 2.4.1 remote: Using turbolinks 5.0.1 remote: Using loofah 2.2.2 remote: Using activesupport 5.1.4 remote: Using sass-listen 4.0.0 remote: Using rails-html-sanitizer 1.0.4 remote: Using sass 3.5.7 remote: Using rails-dom-testing 2.0.3 remote: Using globalid 0.4.1 remote: Using activemodel 5.1.4 remote: Using jbuilder 2.7.0 remote: Using actionview 5.1.4 remote: Using activerecord 5.1.4 remote: Using activejob 5.1.4 remote: Using actionpack 5.1.4 remote: Using actioncable 5.1.4 remote: Using actionmailer 5.1.4 remote: Using railties 5.1.4 remote: Using sprockets-rails 3.2.1 remote: Using coffee-rails 4.2.2 remote: Using jquery-rails 4.3.1 remote: Using rails 5.1.4 remote: Using sass-rails 5.0.6 remote: Installing autoprefixer-rails 9.1.1 remote: Fetching bootstrap-sass 3.3.7 remote: Installing bootstrap-sass 3.3.7 remote: Bundle complete! 22 Gemfile dependencies, 59 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 (3.59s) remote: Cleaning up the bundler cache. remote: Your Gemfile lists the gem rails (= 5.1.4) more than once. remote: You should probably keep only one of them. remote: While it's not a problem now, it could cause errors if you change the version of one of them later. remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. remote: The latest bundler is 1.16.3, but you are currently running 1.15.2. remote: To update, run `gem install bundler` remote: -----> Installing node-v8.10.0-linux-x64 remote: -----> Detecting rake tasks remote: remote: ! remote: ! Could not detect rake tasks remote: ! ensure you can run `$ bundle exec rake -P` against your app remote: ! and using the production group of your Gemfile. remote: ! rake aborted! remote: ! SyntaxError: /tmp/build_25de9153d8b72e9d14a08fa28c9882ed/config/application.rb:18: syntax error, unexpected <<, expecting end-of-input remote: ! <<<<<<<<< saved version remote: ! ^ (略) remote: ! vendor/bundle/bin/rake:17:in `load' remote: ! vendor/bundle/bin/rake:17:in `<main>' remote: ! remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError) remote: ensure you can run `$ bundle exec rake -P` against your app remote: and using the production group of your Gemfile. remote: rake aborted! remote: SyntaxError: /tmp/build_25de9153d8b72e9d14a08fa28c9882ed/config/application.rb:18: syntax error, unexpected <<, expecting end-of-input remote: <<<<<<<<< saved version remote: ^ (略) remote: vendor/bundle/bin/rake:17:in `load' remote: vendor/bundle/bin/rake:17:in `<main>' /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:41:in `block in compile' (略) remote: from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:15:in `<main>' remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to xxxx. remote: To https://git.heroku.com/xxxx.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/xxxx.git'

エラーと思われる部分が非常に多いのですが、以下の部分が原因なのかなと思っています。

Could not detect rake tasks remote: ! ensure you can run `$ bundle exec rake -P` against your app remote: ! and using the production group of your Gemfile. remote: ! rake aborted! remote: ! SyntaxError: /tmp/build_25de9153d8b72e9d14a08fa28c9882ed/config/application.rb:18: syntax error, unexpected <<, expecting end-of-input

試したこと

bundle installをし直したり、Gemfile.lockを削除するといいとのネットの投稿のとおり削除したりしましたが、まったく変化はありません。

エラー文の中に$ bundle exec rake -Pをするようにとの指示も出ているので、してみましたが、解決しませんでした。

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

参考までにGemfileを載せたいと思います。

Gemfile

1source 'https://rubygems.org' 2 3gem 'rails', '5.1.4' 4gem 'puma', '3.9.1' 5gem 'sass-rails', '5.0.6' 6gem 'uglifier', '3.2.0' 7gem 'coffee-rails', '4.2.2' 8gem 'jquery-rails', '4.3.1' 9gem 'turbolinks', '5.0.1' 10gem 'jbuilder', '2.7.0' 11 12group :development, :test do 13 gem 'sqlite3', '1.3.13' 14 gem 'byebug', '9.0.6', platform: :mri 15end 16 17group :development do 18 gem 'web-console', '3.5.1' 19 gem 'listen', '3.1.5' 20 gem 'spring', '2.0.2' 21 gem 'spring-watcher-listen', '2.0.1' 22end 23 24group :test do 25 gem 'rails-controller-testing', '1.0.2' 26 gem 'minitest-reporters', '1.1.14' 27 gem 'guard', '2.13.0' 28 gem 'guard-minitest', '2.4.4' 29end 30 31group :production do 32 gem 'pg', '0.20.0' 33end 34 35# Windows環境ではtzinfo-dataというgemを含める必要があります 36gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 37 38source 'https://rubygems.org' 39 40gem 'rails', '5.1.4' 41gem 'bootstrap-sass', '3.3.7'

どうぞ、よろしくお願いします。

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

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

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

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

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

guest

回答1

0

ベストアンサー

エラーと思われる部分が非常に多いのですが、以下の部分が原因なのかなと思っています。

そうですね、その推測はするどいです。特に最後の行ですね。

というわけで、config/application.rbの18行目にsyntax errorがあるようなのですが、そのファイルの18行目と、その前後に<<<<<<<<< saved versionみたいな変な行が入っていないでしょうか。それを修正すると一歩前進しそうです。

投稿2018/08/16 17:30

takahashim

総合スコア1877

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

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

ayachika

2018/08/16 22:31

ご回答のとおり該当のファイルに<<<<<<を持つ行が3つあり、それをすべて削除したところ、git push heroku成功しました!この行がなぜ入っていたのかわかりませんが、エラーの見方も勉強になりました。感謝します。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問