简体   繁体   English

无法推送到heroku

[英]Can't push to the heroku

I was pushing the current git repository into the heroku.我正在将当前的 git 存储库推送到 heroku。 That online application was developed using Scala and IntelliJ.该在线应用程序是使用 Scala 和 IntelliJ 开发的。 And I don't know how to fix this error.我不知道如何解决这个错误。

$ 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'

Read this doc which will explain to you what to do.阅读此文档,它将向您解释该怎么做。
https://devcenter.heroku.com/articles/buildpacks https://devcenter.heroku.com/articles/buildpacks

Setting a buildpack on an application在应用程序上设置 buildpack

You can change the buildpack used by an application by setting the buildpack value.您可以通过设置 buildpack 值来更改应用程序使用的 buildpack。
When the application is next pushed, the new buildpack will be used.下次推送应用程序时,将使用新的 buildpack。

 $ heroku buildpacks:set heroku/php

Buildpack set.构建包集。 Next release on random-app-1234 will use heroku/php. random-app-1234 上的下一个版本将使用 heroku/php。
Run git push heroku master to create a new release using this buildpack.运行git push heroku master以使用此构建包创建新版本。

This is whay its not working for you since you did not set it up.这就是为什么它不适合你,因为你没有设置它。

... When the application is next pushed, the new buildpack will be used. ... 下次推送应用程序时,将使用新的 buildpack。

You may also specify a buildpack during app creation : You may also specify a buildpack during app creation

$ heroku create myapp --buildpack heroku/python

There has to be a .git directory in the root of your project.项目的根目录中必须有一个.git目录。

If you don't see that directory run git init and then re-associate your remote.如果您没有看到该目录,请运行git init然后重新关联您的遥控器。

Like so:像这样:

heroku git:remote -a herokuAppName
git push heroku master

Make sure you have package.json inside root of your project.确保你的项目根目录中有package.json Happy coding :)快乐编码:)

If you are a python user -如果您是python用户 -
Create a requirements.txt file preferably using pip freeze > requirements.txt .最好使用pip freeze > requirements.txt创建一个requirements.txt文件。
Add, commit and try pushing it again.添加、提交并再次尝试推送。

If this doesn't work try deleting .git (beware this might remove the associated git history) and follow the above steps again.如果这不起作用,请尝试删除.git (请注意这可能会删除关联的 git 历史记录)并再次执行上述步骤。

Worked for me.为我工作。

If your app is a Scala app, it must have a build.sbt in the root directory, and that file must be checked into Git.如果您的应用程序是 Scala 应用程序,则它的根目录中必须有build.sbt ,并且必须将该文件签入 Git。 You can confirm this by running:您可以通过运行来确认这一点:

$ git ls-files build.sbt

If that file exists and is checked into Git, try running this command:如果该文件存在并已签入 Git,请尝试运行以下命令:

$ heroku buildpacks:set heroku/scala

在创建应用程序时指定 buildpack。

heroku create appname --buildpack heroku/python

You could also select webpack build manually from the UI您也可以从 UI 中手动选择 webpack build 在此处输入图片说明

You need to follow the instructions displayed here, on your case follow scala configuration:您需要按照此处显示的说明进行操作,在您的情况下,请遵循 Scala 配置:

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

After setting up the getting started pack, tweak around the default config and apply to your local repository.设置入门包后,调整默认配置并应用于您的本地存储库。 It should work, just like mine using NodeJS.它应该可以工作,就像我使用 NodeJS 一样。

HTH!哼! :) :)

If you are using django app to deploy on heroku如果您使用 django 应用程序在 heroku 上进行部署

make sure to put request library in the requirements.txt file.确保将请求库放在 requirements.txt 文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM