javascript 节点的heroku:!Heroku 推送被拒绝,未检测到支持 Cedar 的应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13926419/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 20:11:53  来源:igfitidea点击:

heroku for node: ! Heroku push rejected, no Cedar-supported app detected

javascriptnode.jsherokuexpress

提问by David

I am new to heroku and express.js. I try to go through the tutorial, but I cannot make it with the step 'git push heroku master'. I followed the tutorial exactly. Below is the error message:

我是 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 [email protected]:cryptic-journey-9914.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:cryptic-journey-9914.git'

回答by howanghk

did you read the Getting Started with Node.js on Herokuarticle on Heroku Dev Center?

您是否阅读了Heroku Dev Center上的 Heroku上的Node.js 入门文章?

You need to declare your process type with Procfile. To do so, create a file named Procfile, with the following content:

您需要使用 Procfile 声明您的流程类型。为此,请创建一个名为 的文件Procfile,其内容如下:

web: node web.js

assume that your javascript file is called web.js.

假设您的 javascript 文件被称为web.js.

p.s. don't forget to add the Procfile to git and commit it.

ps 不要忘记将 Procfile 添加到 git 并提交它。

回答by mpm

You need a package.json file (and a Procfile), it is likely not the case.

您需要一个 package.json 文件(和一个 Procfile),但情况可能并非如此。

回答by Cory

I have encountered this issue a few time before and it was because I was trying to push a remote branch to heroku.

我之前遇到过这个问题,这是因为我试图将远程分支推送到 heroku。

To solve the problem, instead of using:

要解决问题,而不是使用:

git push heroku master

I used:

我用了:

git push heroku my-branch:master

This pushes the remote branch my-branchin the git repository to the masterbranch of heroku.

这会将my-branchgit 存储库中的远程分支推送到masterheroku的分支。

回答by Jared Beach

For me, doing npm initwas enough

对我来说,做npm init就够了

回答by Guy Sopher

Just for the record, I had the same problem and it turned out to be one of the Config Vars in Heroku. I remove the config vars and the app was pushed successfully.

只是为了记录,我遇到了同样的问题,结果证明它是 Heroku 中的配置变量之一。我删除了配置变量并且应用程序被成功推送。