簡體   English   中英

推送應用程序到heroku

[英]push rails app to heroku

我正在嘗試將rails應用程序推送到heroku。

當我到達最后一步時:

git push heroku master

它不起作用,並給我這些錯誤:

Counting objects: 85, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (74/74), done.
Writing objects: 100% (85/85), 24.38 KiB, done.
Total 85 (delta 23), reused 0 (delta 0)

-----> Heroku receiving push
 !     Heroku push rejected, no Rails or Rack app detected.

error: hooks/pre-receive exited with error code 1
To git@heroku.com:smooth-dusk-26.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:smooth-dusk-26.git'

我不知道我做錯了什么:(

這是我從Heroku得到的答案,它對我有用(在嘗試了不同的pg寶石,適配器以及其他10篇關於此的其他帖子之后)

1)將行:gem'pg'添加到您的Gemfile中。

2)運行命令bundle install install將gem安裝到您的bundle中。

3)暫存Gemfile和Gemfile.lock更改:git add Gemfile Gemfile.lock

4)提交更改:git commit -m“安裝pg gem”

5)重新部署到heroku:git push heroku master

在創建Rails應用程序時,是否將目錄更改為應用程序的目錄? 您必須從應用程序的目錄中執行所有命令。

rails myapp
cd myapp

我在Michael Hartl的Rails教程的第1章中遇到了同樣的錯誤。 在打開Heroku帳戶並配置SSH密鑰后,最終通過發出另一個git commit命令來解決它們: git commit -a -m“Heroku重新發送”

git push heroku master然后成功了。

對我來說,修復它的是index.php的存在。 Heroku似乎檢查了pre-commit上是否存在index.php。

我只是遇到了同樣的問題,試圖將我的應用程序推送到heroku,並沒有上述答案修復它。

我通過將rvm gemset empty清空我的RVM rvm gemset empty ,刪除我的Gemfile.lock(可能最好只重命名)並重新安裝我的寶石來解決這個問題。 在此之后推動工作正常。

在ror網站上的一個指南之后的Windows下遇到了同樣的問題。 在制作了像http://devcenter.heroku.com/articles/quickstart這樣的所有內容后,它就解決了。

似乎問題是因為缺少兩行。

cd myapp

git init

此外,如果您使用的是Rails 3.0,請確保使用雪松堆棧

heroku create --stack cedar

我瀏覽了Rails教程並沒有Heroku(MAC OS X)的單一問題,但你必須遵循指示。

首先,確保添加/提交給Git。 然后,如果你在-b(分支)中,你需要簽出到master,然后合並分支。 如果您對資產進行了更改,則需要rake asset:precompile。

如果您遇到機架問題,請確保您有此文件=> config.ru,內容應如下所示。

# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
run SampleApp::Application

我對Rails和Heroku相對較新,但正如我上面提到的,如果你按照教程的說明進行操作,那么Heroku很容易實現。 如果沒有,我強烈建議您從那里開始!

在此輸入鏈接描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM