【问题标题】:Heroku Deploy Error: No Default LanguageHeroku 部署错误:没有默认语言
【发布时间】:2016-07-28 06:51:14
【问题描述】:

我正在尝试使用 git 推送一些 ruby​​ 代码,并且一直在中途停止。这是我的设置和我得到的错误..

root@slacker:~/ruby# git remote -v
heroku  https://git.heroku.com/warm-woodland-27175.git (fetch)
heroku  https://git.heroku.com/warm-woodland-27175.git (push)
root@slacker:~/ruby# ls
config.ru  myapp.rb
root@slacker:~/ruby# git push heroku master
Counting objects: 4, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 398 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to warm-woodland-27175.
remote:
To https://git.heroku.com/warm-woodland-27175.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/warm-woodland-    27175.git'
root@slacker:~/ruby#

我仍在尝试了解 git 的来龙去脉,但我对为什么 git 无法识别我的编译文件夹中的文件扩展名感到很困惑。我认为这就是它如何获取要使用的语言、.rb .pl 等...任何帮助将不胜感激。

【问题讨论】:

    标签: ruby-on-rails ruby git heroku


    【解决方案1】:

    我在尝试将我的 Sinatra 应用程序部署到 Heroku 时遇到此错误。

    heroku buildpacks:set heroku/ruby
    

    我阅读了https://devcenter.heroku.com/articles/buildpacks,它帮助我完成了解决方案。

    但我从https://devcenter.heroku.com/articles/rack开始 这有助于我了解您需要添加的文件,例如Gemfile 等。确保您执行bundle install

    确保在添加 Gemfile 等之后提交更改。所以

    git add . 
    

    或者任何你需要做的然后提交

    git commit -m "Added files for Heroku deployment"
    

    或根据需要更改消息。然后你可以部署使用

    git push heroku master
    

    现在我的网站使用 heroku 运行

    如果我遗漏了您需要的东西,请在 cmets 中询问,以便我澄清。

    【讨论】:

      【解决方案2】:

      我在尝试使用 Ruby Sinatra 部署到 Heroku 时遇到了同样的问题。就我而言,问题是我对 Ruby 和 Sinatra 是全新的,并且对 gem 和捆绑一无所知。

      实际上我的文件夹中只有我的 app.rb 文件。 根据我阅读的一些指南1,我采取了以下步骤:

      如果我的应用名为 app.rb,则创建一个名为 config.ru 的文件:

      require './hello'
      run Sinatra::Application
      

      创建一个名为Gemfile的文件:

      source 'https://rubygems.org'
      gem 'sinatra'
      

      然后我发现this article 提醒我需要运行bundle install

      然后我将这些文件添加到我的 git 中,推送它,我的工作就开始了!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-03-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多