首页 > 解决方案 > 当我尝试将我的应用推送到 heroku 时出现(远程拒绝)错误

问题描述

我正在尝试将我的后端推送到 heroku 以获取我的全栈应用程序,但是当我在终端上输入“git push heroku master”时,我收到了这个错误

! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ammans-sign-in-backend.git'

我关注的视频也出现了这个错误,但他通过从 package.json 中删除 yarn 解决了这个错误。但我没有安装纱线,所以我不知道是什么导致了这个错误。

完整错误供参考

PS C:\Users\Amman\dunder-mifflin\src\backend> git push heroku master       
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 841 bytes | 420.00 KiB/s, done.
Total 3 (delta 0), 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: 3aa4f9300d4b24e64213357cadb3c360dbff848c
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 3aa4f9300d4b24e64213357cadb3c360dbff848c
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 ammans-sign-in-backend.
remote:
To https://git.heroku.com/ammans-sign-in-backend.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ammans-sign-in-backend.git'

标签: githeroku

解决方案


如果您查看错误,您会发现您尚未选择构建包。因此,只需访问网站并选择您正在使用的语言的 buildpack。


推荐阅读