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

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

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

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

Heroku

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

Ruby on Rails

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

Q&A

0回答

1122閲覧

git push heroku main ができないです。。

ktaraw1574

総合スコア7

Ruby

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

Heroku

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

Ruby on Rails

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

0グッド

0クリップ

投稿2021/01/03 04:08

編集2021/01/03 04:47

railsチュートリアルの3章目でherokuにpushするところでエラーが出ました。

環境は、
mac
ruby 2.7.2
Rails 6.0.3
Bundler version 2.2.4
クラウドIDE(Cloud9)を使わず自分のローカル開発環境で行っています


エラーのログです

Enumerating objects: 119, done. Counting objects: 100% (119/119), done. Delta compression using up to 4 threads Compressing objects: 100% (101/101), done. Writing objects: 100% (119/119), 69.32 KiB | 3.01 MiB/s, done. Total 119 (delta 10), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. remote: Detected buildpacks: Ruby,Node.js remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order remote: -----> Ruby app detected remote: -----> Installing bundler 2.1.4 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.6.6 remote: -----> Installing dependencies using bundler 2.1.4 remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 remote: The dependency byebug (= 11.0.1) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86_64-darwin-19 but the dependency is only for ruby, x86-mingw32, x64-mingw32. To add those platforms to the bundle, run `bundle lock --add-platform ruby x86-mingw32 x64-mingw32`. remote: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86_64-darwin-19 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: Bundle complete! 23 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: Post-install message from i18n: remote: remote: HEADS UP! i18n 1.1 changed fallbacks to exclude default locale. remote: But that may break your application. remote: remote: If you are upgrading your Rails application from an older version of Rails: remote: remote: Please check your Rails app for 'config.i18n.fallbacks = true'. remote: If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be remote: 'config.i18n.fallbacks = [I18n.default_locale]'. remote: If not, fallbacks will be broken in your app by I18n 1.1.x. remote: remote: If you are starting a NEW Rails application, you can ignore this notice. remote: remote: For more info see: remote: https://github.com/svenfuchs/i18n/releases/tag/v1.1.0 remote: remote: Post-install message from sass: remote: remote: Ruby Sass has reached end-of-life and should no longer be used. remote: remote: * If you use Sass as a command-line tool, we recommend using Dart Sass, the new remote: primary implementation: https://sass-lang.com/install remote: remote: * If you use Sass as a plug-in for a Ruby web framework, we recommend using the remote: sassc gem: https://github.com/sass/sassc-ruby#readme remote: remote: * For more details, please refer to the Sass blog: remote: https://sass-lang.com/blog/posts/7828841 remote: remote: Bundle completed (38.46s) remote: Cleaning up the bundler cache. remote: -----> Installing node-v12.16.2-linux-x64 remote: -----> Installing yarn-v1.22.4 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: ! /tmp/build_d2dc1212/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError) remote: ! from /tmp/build_d2dc1212/config/boot.rb:4:in `<top (required)>' remote: ! from /tmp/build_d2dc1212/bin/rake:7:in `require_relative' remote: ! from /tmp/build_d2dc1212/bin/rake:7:in `<main>' remote: ! remote: /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/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: /tmp/build_d2dc1212/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError) ----------------------省略してます 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: a1235217290f0a8ba72a75e0973f8f48ef561204 remote: ! remote: ! We have detected that you have triggered a build from source code with version a1235217290f0a8ba72a75e0973f8f48ef561204 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 gentle-taiga-38886. remote: To https://git.heroku.com/taiga-38886.git ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/taiga-38886.git'

いろいろ調べてみたのですがよくわからなので教えていただきたいです。。。

ログに出ているRuby versionとbundler versionが自分のローカル開発環境と違うのもおかしいのでしょうか?

remote: -----> Using Ruby version: ruby-2.6.6 remote: -----> Installing dependencies using bundler 2.1.4

ちなみにgemfileはこんな感じです

source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'rails', '6.0.3' gem 'puma', '4.3.6' gem 'sass-rails', '5.1.0' gem 'webpacker', '4.0.7' gem 'turbolinks', '5.2.0' gem 'jbuilder', '2.9.1' gem 'bootsnap', '1.4.5', require: false group :development, :test do gem 'sqlite3', '1.4.1' gem 'byebug', '11.0.1', platforms: [:mri, :mingw, :x64_mingw] end group :development do gem 'web-console', '4.0.1' gem 'listen', '3.1.5' gem 'spring', '2.1.0' gem 'spring-watcher-listen', '2.0.1' end group :test do gem 'capybara', '3.28.0' gem 'selenium-webdriver', '3.142.4' gem 'webdrivers', '4.1.2' gem 'rails-controller-testing', '1.0.4' gem 'minitest', '5.11.3' gem 'minitest-reporters', '1.3.8' gem 'guard', '2.16.2' gem 'guard-minitest', '2.4.6' end group :production do gem 'pg', '1.1.4' end # Windows ではタイムゾーン情報用の tzinfo-data gem を含める必要があります gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

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

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

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

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

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

siruku6

2021/01/03 04:18

``` If you are developing on a branch and deploying via git you must run: `git push heroku <branchname>:main` ``` というメッセージが出ていますが、試してみましたか?? ------------ >ログに出ているRuby versionとbundler versionが自分のローカル開発環境と違うのもおかしいのでしょうか? herokuは選択できるバージョンが限られているので、調べてみるとよいかもしれません。 一部のバージョンしか選べなかった記憶があります。 バージョンの指定方法も検索すると簡単にわかると思います。
ktaraw1574

2021/01/03 04:21

試してみると ``` -bash: branchname: No such file or directory ``` と出てしまいます。
siruku6

2021/01/03 04:22

説明が雑ですみません。 <branchname> のところには自分の使っているブランチの名前を書きます。<>も不要です。
ktaraw1574

2021/01/03 04:26

いえ、僕の方こそ理解力がなくて申し訳ないです。返信ありがとうございます! ``` git push heroku main ``` を実行するとやはり質問している内容と同じエラーが出てしまいます
siruku6

2021/01/03 04:33 編集

使用されているブランチは、おそらくmasterだと思ったので、 ``` git push heroku master:main ``` を実行してみるとどうなりますか?? `git push heroku <branchname>:main`これは、そういう意味で書かれている気がします。
ktaraw1574

2021/01/03 04:46

すみません。使用しているブランチは、masterではなくmainです 質問の題名が間違えてますね。git push heroku main ができないに修正します ``` git push heroku main:main ``` でも同じエラーが起きてしまいます。
siruku6

2021/01/03 04:59

エラーメッセージで検索してみたところこんな記事が出てきました https://stackoverflow.com/questions/64265355/heroku-if-you-are-developing-on-a-branch-and-deploying-via-git-you-must-run 検索キーワード「We have detected that you have triggered a build from source code with version」 HEADやmain、masterなどを位置を入れ替えて試してみてもいいかもしれません.... herokuでこの問題に遭遇したことはないので何とも言えないですが、記載してくださったエラーメッセージに書かれている通り、対策は`https://devcenter.heroku.com/articles/duplicate-build-version`を参照した方がよさそうです。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問