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 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 个解决方案
#1
16
did you read the Getting Started with Node.js on Heroku article on Heroku Dev Center?
你是否在Heroku开发中心的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.
附:不要忘记将Procfile添加到git并提交它。
#2
7
You need a package.json file (and a Procfile), it is likely not the case.
你需要一个package.json文件(和一个Procfile),很可能不是这样。
#3
2
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-branch
in the git repository to the master
branch of heroku.
这将git存储库中的远程分支my-branch推送到heroku的master分支。
#4
0
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中的Config Vars之一。我删除了配置变量,成功推送了应用程序。
#5
0
For me, doing npm init
was enough
对我来说,做npm init就足够了
#1
16
did you read the Getting Started with Node.js on Heroku article on Heroku Dev Center?
你是否在Heroku开发中心的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.
附:不要忘记将Procfile添加到git并提交它。
#2
7
You need a package.json file (and a Procfile), it is likely not the case.
你需要一个package.json文件(和一个Procfile),很可能不是这样。
#3
2
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-branch
in the git repository to the master
branch of heroku.
这将git存储库中的远程分支my-branch推送到heroku的master分支。
#4
0
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中的Config Vars之一。我删除了配置变量,成功推送了应用程序。
#5
0
For me, doing npm init
was enough
对我来说,做npm init就足够了