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

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

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

FlaskはPython用のマイクロフレームワークであり、Werkzeug・Jinja 2・good intentionsをベースにしています。

Git

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

Heroku

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

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

2229閲覧

error: failed to push some refs to の解決策を教えて欲しいです。

Issei.Yaguchi

総合スコア1

Flask

FlaskはPython用のマイクロフレームワークであり、Werkzeug・Jinja 2・good intentionsをベースにしています。

Git

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

Heroku

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

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2021/09/01 07:51

Python初心者です。lineのchat botを作成したく
https://www.python-beginners.com/entry/20190221/1550754314#section1
のサイトをなぞりながら進めてきたのですが、最後の$git push heroku mianでエラーが出てしまい中々解決できずにいます。解決方法を教えてもらえると幸いです。
ちなみに、おうむ返しをしてくれるchatbotです。
flaskとline-bot-sdkはpipenvでインストールしてます。

エラーコード

(isseiyaguchi) isseiyaguchi@IsseinoMacBook-Pro chatbot % git push heroku main Enumerating objects: 14, done. Counting objects: 100% (14/14), done. Delta compression using up to 8 threads Compressing objects: 100% (13/13), done. Writing objects: 100% (14/14), 2.62 KiB | 1.31 MiB/s, done. Total 14 (delta 4), reused 0 (delta 0), pack-reused 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: ! No default language could be detected for this app. remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. remote: See https://devcenter.heroku.com/articles/buildpacks remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: 6d72f6ad0735ae7ef77d147f89bfa14c8f9409f4 remote: ! remote: ! We have detected that you have triggered a build from source code with version 6d72f6ad0735ae7ef77d147f89bfa14c8f9409f4 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 isseichat. remote: To https://git.heroku.com/isseichat.git ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/isseichat.git'

試したこと

・リモートの変更をマージしてからpush
$git fetch
$git rebase heroku/main

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

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

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

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

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

texo

2021/09/01 08:23

herokuの管理画面のActivityにエラーが記録されていればそちらの記載もお願いしたいです
Issei.Yaguchi

2021/09/01 08:31

返信ありがとうございます。-----> Building on the Heroku-20 stack -----> Determining which buildpack to use for this app ! No default language could be detected for this app. HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. See https://devcenter.heroku.com/articles/buildpacks ! Push failed このような感じです。
texo

2021/09/01 08:34

ビルドパックの設定をする必要があるのだと思います。`heroku buildpacks:set heroku/python`を実行してみて頂けますでしょうか?
Issei.Yaguchi

2021/09/01 08:44

実行し、良い感じのanswerが返ってきました。もう一度同じコードで実行しとたところ、Error: The buildpack heroku/python is already set on your app. が返ってきたので大丈夫かと思います。
guest

回答1

0

ベストアンサー

下記のエラー文の通り、buildpackを設定する必要があります。

remote: ! No default language could be detected for this app. remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. remote: See https://devcenter.heroku.com/articles/buildpacks remote: remote: ! Push failed

エラーメッセージに記載されているURL先を確認すると、各言語ごとに設定パラメータが書かれています。
Pythonの場合は下記のように設定します。

heroku buildpacks:set heroku/python

https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-python

投稿2021/09/01 08:45

texo

総合スコア31

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

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

texo

2021/09/02 04:13

プロジェクトルートにrequirements.txtが存在してますでしょうか? 回答に記載したURL内に記載があります。 > A requirements.txt must be present at the root of your application's repository to deploy.
Issei.Yaguchi

2021/09/02 04:17

解決しましたありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問