Heroku对Node的支持:!Heroku推送被拒绝,未检测到支持Cedar的应用程序。

11

我对Heroku和Express.js都是新手。我尝试按照教程进行,但在 'git push heroku master' 这一步无法成功。我完全按照教程操作,以下是错误信息:

Counting objects: 269, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (241/241), done.
Writing objects: 100% (269/269), 188.93 KiB, done.
Total 269 (delta 9), reused 0 (delta 0)
 !     Heroku push rejected, no Cedar-supported app detected

To git@heroku.com:cryptic-journey-9914.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:cryptic-journey-9914.git'
5个回答

16

3
可能是 package.json 文件,我在 git 中设置了忽略 json 文件。我强制让 git 将它添加进去,现在它可以工作了,谢谢! - David
你可能还想从GitHub检查一下这个.gitignore文件。 - Cristian Douce
3
当他们在Heroku文档中谈论文本文件时,我想补充一点,它被称为Procfile而不是Procfile.txt。 @howanghk说得对,“创建一个名为Procfile的文件”,在文档中他们只是说“使用Procfile,这是应用程序根目录中的文本文件……”。 他们的文档很糟糕,我怎么知道文件叫Procfile呢?他们应该付你钱来改进他们的文档 :) - Michael Moeller

7

你需要一个package.json文件(和Procfile文件),很可能还没有创建。


2

我曾经遇到过这个问题,原因是我试图将一个远程分支推送到Heroku。

为了解决这个问题,不要使用:

git push heroku master

我使用了:

git push heroku my-branch:master

这将把git仓库中的远程分支my-branch推送到heroku的master分支。


0

对我来说,只需要执行npm init命令就足够了。


0
仅供参考,我遇到了同样的问题,结果发现是Heroku中的一个Config变量引起的。 我删除了这些配置变量,应用程序就成功推送了。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接