为什么 Heroku 无法检测到我的 Sinatra 应用程序?



我使用的是Heroku开发中心提供的最简单的结构和代码:

"hello.rb"文件

require 'sinatra'
get '/' do 
"Hello World"
end

"config.ru"文件

require './hello'
run Sinatra::Application

"gemfile"文件

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

在终端上我做了:

$git init
$heroku create
$bundle
$git add . 
$git commit -m "bundle"
$git push heroku master 

该应用程序与heroku本地应用程序兼容,但当尝试推送任何Sinatra应用程序时,总是会收到相同的错误消息:

> Enumerating objects: 29, done. Counting objects: 100% (29/29), done.
> Delta compression using up to 12 threads Compressing objects: 100% (25/25), done. 
> Writing objects: 100% (29/29), 5.63 KiB | 1.88 MiB/s, done.
> Total 29 (delta 3), 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 sinatrina. remote:

添加procfile或bundlepack总是返回与上面相同的消息。我是不是少了一步?

您的代码非常简单,我猜Heroku无法猜测语言。尝试使用:heroku buildpacks:set heroku/ruby --app your_app手动设置构建包。

请注意,首先需要安装Heroku CLI并运行heroku login才能登录到您的帐户。

最新更新