我是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'
你读过 Heroku 上 Heroku 上的 Node.js 入门文章吗?
您需要使用 Procfile 声明您的流程类型。为此,请创建一个名为 Procfile
的文件,其中包含以下内容:
web: node web.js
假设您的 JavaScript 文件名为 web.js
。
p.s. 不要忘记将 Procfile 添加到 git 并提交它。
一个package.json文件(和一个Procfile),但情况可能并非如此。
我之前遇到过几次这个问题,这是因为我试图将远程分支推送到 heroku。
要解决此问题,而不是使用:
git push heroku master
我使用过:
git push heroku my-branch:master
这会将 git 仓库中的远程分支my-branch
推送到 heroku 的master
分支。
只是为了记录,我遇到了同样的问题,结果证明它是 Heroku 中的配置变量之一。我删除了配置变量,应用程序已成功推送。
,做npm init
就足够