2012-12-18 35 views
11

我是heroku和express.js的新手。我嘗試通過教程,但我無法通過'git push heroku master'這一步來完成。我完全按照教程。下面是錯誤信息:heroku for node:! Heroku推送被拒絕,沒有檢測到Cedar支持的應用程序

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' 

回答

16

您是否閱讀過Heroku Dev Center的Getting Started with Node.js on Heroku文章?您需要登錄declare your process type with Procfile。要做到這一點,創建一個名爲Procfile文件,包含以下內容:

web: node web.js 

假設你的JavaScript文件名爲web.js

p.s.不要忘記將Procfile添加到git並提交它。

+3

它可能的package.json,我設置爲忽略在git的JSON文件。我強制git添加它,現在它可以工作,謝謝! – David

+0

你可能也想從github上檢查這個[.gitignore](https://github.com/github/gitignore/blob/master/Node.gitignore)文件。 –

+3

當他們談論一個關於heroku文檔的文本文件時,我想補充說它被稱爲Procfile而不是Procfile.txt。 @howanghk你說得對「創建一個名爲Procfile的文件」,在文檔中他們只是說「使用Procfile,一個文本文件在你的應用程序的根目錄下......」。他們的文檔很糟糕,我應該在哪裏知道這個文件叫做Procfile。他們應該付錢給他們製作他們的文檔:) –

7

你需要一個package.json文件(和一個Procfile),它可能不是這種情況。

+0

我有兩個文件 – David

0

只是爲了記錄,我有同樣的問題,它原來是Heroku中的配置變量之一。 我刪除了配置變量,並且該應用程序被推送成功。

2

我之前幾次遇到過這個問題,那是因爲我試圖將一個遠程分支推送到heroku。

爲了解決這個問題,而不是使用:

git push heroku master 

我使用:

git push heroku my-branch:master 

這推動所述遠程分支my-branch在git倉庫到的Heroku的master分支。

0

對我來說,做npm init足夠

相關問題