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

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

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

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

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

Ruby on Rails

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

Q&A

解決済

1回答

842閲覧

Rails TutorialでHeroku にpushができません。

ohno_

総合スコア0

Ruby

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

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

Ruby on Rails

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

0グッド

0クリップ

投稿2021/10/02 03:54

編集2021/10/02 04:36

前提・実現したいこと

Rails Tutorialを進めており、Herokuにデプロイするところで詰まっています。
gitにcommitし、herokuにpushした際にエラーが起こりました。
学習し始めたばかりで理解不足かもしれませんがよろしくお願いいたします。

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

ubuntu:~/environment/sample_app (master) $ git push heroku master Counting objects: 113, done. Compressing objects: 100% (95/95), done. Writing objects: 100% (113/113), 56.48 KiB | 2.09 MiB/s, done. Total 113 (delta 9), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Determining which buildpack to use for this app 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 1.17.3 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 1.17.3 remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 bundle install -j4 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: Fetching rake 12.3.3 remote: Installing rake 12.3.3 remote: Fetching concurrent-ruby 1.1.9 remote: Fetching thread_safe 0.3.6 ーーー途中省略ーーー remote: Fetching rails 6.0.3 remote: Fetching webpacker 4.0.7 remote: Fetching sass-rails 5.1.0 remote: Installing rails 6.0.3 remote: Installing sass-rails 5.1.0 remote: Installing webpacker 4.0.7 remote: Bundle complete! 23 Gemfile dependencies, 60 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 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 (37.36s) 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: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: yarn install v1.22.4 remote: [1/4] Resolving packages... remote: [2/4] Fetching packages... remote: info fsevents@2.3.2: The platform "linux" is incompatible with this module. remote: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. remote: [3/4] Linking dependencies... remote: warning " > webpack-dev-server@4.3.0" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0". remote: warning "webpack-dev-server > webpack-dev-middleware@5.2.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". remote: [4/4] Building fresh packages... remote: Done in 5.78s. remote: I, [2021-10-02T02:02:18.263445 #1070] INFO -- : Writing /tmp/build_d1931b29/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css remote: I, [2021-10-02T02:02:18.264168 #1070] INFO -- : Writing /tmp/build_d1931b29/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz remote: Compiling… remote: Compilation failed: remote: error Command "webpack" not found. remote: remote: yarn run v1.22.4 remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. remote: 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: e800f4f40580c10d2e52b16ba8de8e7c6a4ec2b5 remote: ! remote: ! We have detected that you have triggered a build from source code with version e800f4f40580c10d2e52b16ba8de8e7c6a4ec2b5 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 polar-lake-23526. remote: To https://git.heroku.com/polar-lake-23526.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/polar-lake-23526.git'

試したこと

・gemを一度uninstallし、bundle installでGemfile.lockを生成し直してみました。
・AWS cloud9で新しい環境を作り、初めから作り直しましたが、同じエラーに当たりました。
・gem listを見てみるとbundlerが二つありました、これも原因の一つなのでしょうか?

bundler (default: 1.17.2, 1.17.1)

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

・macOS
・rails 6.0.3
・ruby 2.6.3p62 (2019-04-16 revision 67580) x86_64-linux

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

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

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

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

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

MasaSakano

2021/10/02 10:20

手元のマシンではアプリはちゃんと走りますか? また、Railsのtop directoryの直下のbin/ に webpack はありますか? bin/ に、rails, rake, yarn などとともに webpackが必要です。
ohno_

2021/10/02 13:32

bin直下にwebpackはありました。 rails serverを起動したら「Your Yarn packages are out of date! Please run `yarn install --check-files` to update.」と言われたのでそれに従ったところ「hello world」と表示させることはできました。 その後、「git push heroku master」を実行しましたが、「error Command "webpack" not found.」と言われたのですが、webpackが正しく認識されていないのでしょうか。 これだけの情報では難しいとは思うのですが、何かしら教えていただけましたら幸いです。
MasaSakano

2021/10/02 14:18

大丈夫だとは思いますが、念のため、git pushの前にローカルで git commitはしていますね?
ohno_

2021/10/03 08:13

MasaSakanoさん 私の質問について考えてくださり誠にありがとうございました。 今回はなんとか自己解決することができました。
guest

回答1

0

自己解決

bundle exec rails webpacker:install

上記のコマンドを実行したところherokuへのデプロイができ、期待していたhello worldを画面に表示することができました。

投稿2021/10/03 08:11

ohno_

総合スコア0

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

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

MasaSakano

2021/10/03 16:07

解決したようで良かったです! 参考までに、Rails 6 の場合、 bin/rails webpacker:install が標準のはずです。bundle exec はRails 4以前の記法です。後方互換性のため、Rails 6でもまだ使えるようです。ただし、bundle execだと、システム全体のRailsとアプリに使うRailsとのバージョンに差異がある場合、100%正しく動くかどうか知りません。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問