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

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

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

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

Q&A

1回答

635閲覧

Herokuでgit push heroku masterした際のエラー

M.Y

総合スコア10

Ruby on Rails 6

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

0グッド

0クリップ

投稿2022/04/27 16:19

前提・実現したいこと

アプリ作成中で、Herokuにデプロイしようとして、
git push heroku master をした際のエラーになります。

Herokuにプッシュしてデプロイできることを目指したいと思っています。
ローカル環境では問題なく表示されます。

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

Heroku

1-----> Building on the Heroku-18 stack 2-----> Using buildpacks: 3 1. heroku/nodejs 4 2. heroku/ruby 5-----> Node.js app detected 6 7-----> Creating runtime environment 8 9 NPM_CONFIG_LOGLEVEL=error 10 USE_YARN_CACHE=true 11 NODE_ENV=production 12 NODE_MODULES_CACHE=true 13 NODE_VERBOSE=false 14 15-----> Installing binaries 16 engines.node (package.json): 14.x.x 17 engines.npm (package.json): unspecified (use default) 18 engines.yarn (package.json): unspecified (use default) 19 20 Resolving node version 14.x.x... 21 Downloading and installing node 14.19.1... 22 Using default npm version: 6.14.16 23 Resolving yarn version 1.22.x... 24 Downloading and installing yarn (1.22.18) 25 Installed yarn 1.22.18 26 27-----> Installing dependencies 28 Installing node modules (yarn.lock) 29 yarn install v1.22.18 30 [1/4] Resolving packages... 31 [2/4] Fetching packages... 32 [3/4] Linking dependencies... 33 warning " > webpack-dev-server@4.8.1" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0". 34 warning "webpack-dev-server > webpack-dev-middleware@5.3.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". 35 [4/4] Building fresh packages... 36 Done in 20.11s. 37 38-----> Build 39 40-----> Pruning devDependencies 41 yarn install v1.22.18 42 [1/4] Resolving packages... 43 [2/4] Fetching packages... 44 [3/4] Linking dependencies... 45 warning " > webpack-dev-server@4.8.1" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0". 46 warning "webpack-dev-server > webpack-dev-middleware@5.3.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". 47 [4/4] Building fresh packages... 48 warning Ignored scripts due to flag. 49 Done in 2.80s. 50 51-----> Caching build 52 - yarn cache 53 54-----> Build succeeded! 55 ! This app may not specify any way to start a node process 56 https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type 57 ! Unmet dependencies don't fail yarn install but may cause runtime issues 58 https://github.com/npm/npm/issues/7494 59-----> Ruby app detected 60-----> Installing bundler 2.3.10 61-----> Removing BUNDLED WITH version in the Gemfile.lock 62-----> Compiling Ruby/Rails 63-----> Using Ruby version: ruby-2.6.5 64-----> Installing dependencies using bundler 2.3.10 65 Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 66 67(中略) 68 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties. 69 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 70 ["@babel/plugin-proposal-private-property-in-object", { "loose": true }] 71 to the "plugins" section of your Babel config. 72 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-property-in-object. 73 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 74 ["@babel/plugin-proposal-private-methods", { "loose": true }] 75 to the "plugins" section of your Babel config. 76 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties. 77 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 78 ["@babel/plugin-proposal-private-property-in-object", { "loose": true }] 79 to the "plugins" section of your Babel config. 80 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-property-in-object. 81 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 82 ["@babel/plugin-proposal-private-methods", { "loose": true }] 83 to the "plugins" section of your Babel config. 84 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties. 85 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 86 ["@babel/plugin-proposal-private-property-in-object", { "loose": true }] 87 to the "plugins" section of your Babel config. 88 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-property-in-object. 89 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 90 ["@babel/plugin-proposal-private-methods", { "loose": true }] 91 to the "plugins" section of your Babel config. 92 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties. 93 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 94 ["@babel/plugin-proposal-private-property-in-object", { "loose": true }] 95 to the "plugins" section of your Babel config. 96 Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-property-in-object. 97 The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding 98 ["@babel/plugin-proposal-private-methods", { "loose": true }] 99 to the "plugins" section of your Babel config. 100 101 ! 102 ! Precompiling assets failed. 103 ! 104 ! Push rejected, failed to compile Ruby app. 105 ! Push failed 106

おそらくここが問題だとは思いいろいろ調べてみましたが、どのような意味になるのか分かりませんでした。

試したこと

このへんのコマンドは試してみましたが特に変わりませんでした。
参考資料:https://qiita.com/nto300002/items/54a3c8d96956cbdd7cf1#%E7%B5%90%E8%AB%96

$ heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2
をした後に、git push heroku master をしたが特に変わらず。
参考資料:https://qiita.com/ho_soft/items/90733a77c04539504206

おそらくバージョンの問題なのではないかと思いますが、どのように変えればいいのかがわかりませんでした。

``Heroku
Building on the Heroku-18 stack
-----> Using buildpacks:
1. heroku/nodejs
2. heroku/ruby
-----> Node.js app detected

buildpacks:のところが怪しそうですがどのようにすればいいのか分かりませんでした。 ```Heroku Build succeeded! ! This app may not specify any way to start a node process https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type ! Unmet dependencies don't fail yarn install but may cause runtime issues

このへんも調べてみましたがよく分かりませんでした。

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

同じようなHerokuでのエラーが見られるので、どこかに解決法がのっているかもしれませんが理解することができませんでした。
長文になり分かりにくいかと思いますがご教授いただけると幸いです。よろしくお願いします。

ここにより詳細な情報を記載してください。

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

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

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

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

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

guest

回答1

0

このURLにはアクセスしましたか?
https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type
出力されているエラーメッセージに含まれていますよね。

! This app may not specify any way to start a node process https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type

Procfileが存在せず package.json ファイルが存在するような場合、 Heroku側では自動的に node.js サーバーを起動する手段として npm start を実行してみようとするようですが、 "start" が指定されていないので混乱しているようです。

あなたのアプリケーションのコードが一切提示されていないので推測ですが、基本的にはRailsアプリケーションなのでしょう。
Heroku公式のRails6の手順を確認し、状況を確認することをおすすめします。
https://devcenter.heroku.com/articles/getting-started-with-rails6

投稿2022/04/27 19:10

mather

総合スコア6753

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

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

M.Y

2022/04/28 01:37

ご教授いただきありがとうございます。 https://devcenter.heroku.com/articles/getting-started-with-rails6 いただいたRails6のガイドを見て進めてみました。 gem 'sqlite3' というgemを導入して、bundle installしたところ いろいろと新たなエラーが出たため、一度アプリを消して、再度createで作成しました。 その後、おそらくrails のバージョンを2.6.6にすれば進展しそうなのですが、rbenv install 2.6.6をしたところ以下のようになりました。 Downloading openssl-1.1.1n.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a Installing openssl-1.1.1n... Installed openssl-1.1.1n to /Users/manomeyuya/.rbenv/versions/2.6.6 Downloading ruby-2.6.6.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2 Installing ruby-2.6.6... ruby-build: using readline from homebrew BUILD FAILED (macOS 12.2.1 using ruby-build 20220426) Inspect or clean up the working tree at /var/folders/1l/_k867lcs7f54f5hgjp_k9df80000gn/T/ruby-build.20220428101026.32736.tA44Mx Results logged to /var/folders/1l/_k867lcs7f54f5hgjp_k9df80000gn/T/ruby-build.20220428101026.32736.log Last 10 log lines: checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for cd using physical directory... cd -P checking whether CFLAGS is valid... yes checking whether LDFLAGS is valid... no configure: error: something wrong with LDFLAGS="-L/Users/○/.rbenv/versions/2.6.6/lib " make: *** No targets specified and no makefile found. Stop. % rbenv versions system * 2.6.5 (set by /Users/○/projects/one-line-diary/.ruby-version) % bundle install Your Ruby version is 2.6.5, but your Gemfile specified 2.6.6 バージョンが2.6.5から変更できません。 いろいろと調べて試してはみてますが、ここから動きなしというところです。
mather

2022/04/28 04:08

翻訳などを使って読んでほしいのですが、 Edit your Gemfile and change this line: gem 'sqlite3' To this: gem 'pg' というのは、「sqlite3 と書いてある部分を pg に変更してくれ」という意味です。Herokuではsqlite3が使えません。(Herokuではなくローカルでテストする場合は使えますが) rbenvのインストールエラーについてはよくわかりませんが、2.6.5で困らないのであれば、 Gemfile に書いてあるバージョン指定の方を 2.6.5 にしても良いと思います。
M.Y

2022/04/30 00:22

ありがとうございます。 herokuのバージョンを20、railsのバージョンを2.6.5に変更しましたが、以下のようにエラーになります。 remote: ! The Ruby version you are trying to install does not exist on this stack. remote: ! remote: ! You are trying to install ruby-2.6.5 on heroku-20. remote: ! remote: ! Ruby ruby-2.6.5 is present on the following stacks: remote: ! remote: ! - heroku-18 remote: ! remote: ! Heroku recommends you use the latest supported Ruby version listed here: remote: ! https://devcenter.heroku.com/articles/ruby-support#supported-runtimes remote: ! remote: ! For more information on syntax for declaring a Ruby version see: remote: ! https://devcenter.heroku.com/articles/ruby-versions remote: ! herokuのバージョンを18に下げるということでしょうか。さげたところ以下のようになります。 remote: This app is using the Heroku-18 stack, which is supported until April 30th, 2023. remote: A newer stack is available: Heroku-20. To upgrade, see: remote: https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack またgem 'pg'をbundle installしようとした際もエラーになってしまいます。 An error occurred while installing pg (1.3.5), and Bundler cannot continue. Make sure that `gem install pg -v '1.3.5' --source 'https://rubygems.org/'` succeeds before bundling. エラー文をみる感じだとバージョンを変更すればいいと思っていましたがバージョンの変え方がよくないのでしょうか。助言いただいたものの解決できず申し訳ないです。 https://qiita.com/___fff_/items/12c8ab953bc6aaeb8c24
hoshi-takanori

2022/04/30 04:35

そのエラーメッセージは、heroku-20 は ruby-2.6.5 に対応してないと言ってます。 たぶん、heroku-18 のまま ruby-2.6.5 にすれば良いのでは?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問