Heroku部署-推送被拒绝,未检测到Cedar支持的应用程序

Heroku deploying - Push rejected, no Cedar-supported app detected

本文关键字:检测 Cedar 支持 应用程序 部署 拒绝 Heroku      更新时间:2023-09-26

我正试图在heroku服务器上部署我的3d游戏(使用three.js创建)。但是在一个命令"gitpushheroku大师"后,我得到了以下问题:

Initializing repository, done.
Counting objects: 252, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (251/251), done.
Writing objects: 100% (252/252), 2.38 MiB | 89.00 KiB/s, done.
Total 252 (delta 55), reused 0 (delta 0)
-----> Removing .DS_Store files
 !     Push rejected, no Cedar-supported app detected
To git@heroku.com:infinite-woodland-7676.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:infinite-woodland-7676.git'

链接到存储库-->https://github.com/mkkroliks/Snake3d

我没有使用heroku的经验,所以这可能是一个简单的解决方案,但我在网上找不到。

您需要添加一个描述如何运行应用程序的Procfile或一个描述依赖关系的package.json文件,以便Heroku可以确定这是什么类型的应用程序并相应地编译它。

类似于:

  • https://devcenter.heroku.com/articles/getting-started-with-nodejs#define-a-procfile

  • https://devcenter.heroku.com/articles/getting-started-with-nodejs#declare-应用程序依赖项

根据我的经验,有四个潜在的问题。

首先,您需要确保您拥有能够执行脚本的Procfile。它应该包含这样的内容:

节点服务器.js

其次,您需要确保您的package.json具有与npm开始键一起列出的所有必要的依赖项。要确保加载了所有依赖项,请删除node_modules文件夹,运行"npm install --production",然后尝试运行应用程序。如果您缺少任何依赖项,您将得到一个缺少的模块错误。

第三,确保您的应用程序在heroku's环境中工作。在Procfile目录中的命令行中运行"foreman start web",然后在localhost:5000. 上查看您的站点

第四个可能的错误源(也是我遇到的错误)是所有这些文件(Procfile and package.json)都需要在git根目录中。即使这些文件不在根目录中,Foreman也可以运行,所以只需仔细检查即可。