繁体   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