簡體   English   中英

無法推送到heroku

[英]Can't push to the heroku

我正在將當前的 git 存儲庫推送到 heroku。 該在線應用程序是使用 Scala 和 IntelliJ 開發的。 我不知道如何解決這個錯誤。

$ git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 531 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
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: Verifying deploy....
remote: 
remote: !   Push rejected to salty-coast-14102.
remote: 
To https://git.heroku.com/salty-coast-14102.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/salty-coast-14102.git'

閱讀此文檔,它將向您解釋該怎么做。
https://devcenter.heroku.com/articles/buildpacks

在應用程序上設置 buildpack

您可以通過設置 buildpack 值來更改應用程序使用的 buildpack。
下次推送應用程序時,將使用新的 buildpack。

 $ heroku buildpacks:set heroku/php

構建包集。 random-app-1234 上的下一個版本將使用 heroku/php。
運行git push heroku master以使用此構建包創建新版本。

這就是為什么它不適合你,因為你沒有設置它。

... 下次推送應用程序時,將使用新的 buildpack。

You may also specify a buildpack during app creation

$ heroku create myapp --buildpack heroku/python

項目的根目錄中必須有一個.git目錄。

如果您沒有看到該目錄,請運行git init然后重新關聯您的遙控器。

像這樣:

heroku git:remote -a herokuAppName
git push heroku master

確保你的項目根目錄中有package.json 快樂編碼:)

如果您是python用戶 -
最好使用pip freeze > requirements.txt創建一個requirements.txt文件。
添加、提交並再次嘗試推送。

如果這不起作用,請嘗試刪除.git (請注意這可能會刪除關聯的 git 歷史記錄)並再次執行上述步驟。

為我工作。

如果您的應用程序是 Scala 應用程序,則它的根目錄中必須有build.sbt ,並且必須將該文件簽入 Git。 您可以通過運行來確認這一點:

$ git ls-files build.sbt

如果該文件存在並已簽入 Git,請嘗試運行以下命令:

$ heroku buildpacks:set heroku/scala

在創建應用程序時指定 buildpack。

heroku create appname --buildpack heroku/python

您也可以從 UI 中手動選擇 webpack build 在此處輸入圖片說明

您需要按照此處顯示的說明進行操作,在您的情況下,請遵循 Scala 配置:

https://devcenter.heroku.com/articles/getting-started-with-scala#introduction

設置入門包后,調整默認配置並應用於您的本地存儲庫。 它應該可以工作,就像我使用 NodeJS 一樣。

哼! :)

如果您使用 django 應用程序在 heroku 上進行部署

確保將請求庫放在 requirements.txt 文件中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM