Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在Heroku上部署Sinatra应用程序时出错_Ruby_Heroku_Sinatra - Fatal编程技术网

Ruby 在Heroku上部署Sinatra应用程序时出错

Ruby 在Heroku上部署Sinatra应用程序时出错,ruby,heroku,sinatra,Ruby,Heroku,Sinatra,作为Heroku的新手,我在将简单的基于Sinatra的应用程序部署到Heroku时遇到了很多麻烦。我已经完成了所有步骤,应用程序也得到了部署。我已经按照这里给出的说明进行了操作: 我的config.ru is文件如下所示: require './sinatratest.rb' run Sinatra::Application 我的档案是 source 'https://rubygems.org' gem 'sinatra' Sinatratest.rb如下所示: require 'sin

作为Heroku的新手,我在将简单的基于Sinatra的应用程序部署到Heroku时遇到了很多麻烦。我已经完成了所有步骤,应用程序也得到了部署。我已经按照这里给出的说明进行了操作:

我的config.ru is文件如下所示:

require './sinatratest.rb'
run Sinatra::Application
我的档案是

source 'https://rubygems.org'
gem 'sinatra'
Sinatratest.rb如下所示:

require 'sinatra'
require './test.rb'

get '/'  do
    result = FooRunner.run!

     File.open('output.json','w') do |f|
        f.write result
     end

    content_type :text
    result
end
和test.rb包括以下gems:

require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'date'
require 'json'
我的直觉告诉我应该在Gemfile中包含所有的宝石,但是当我这样做时,我的Gemfile看起来是这样的

source 'https://rubygems.org'
gem 'sinatra'
gem 'open-uri'
gem 'nokogiri'
gem 'json'
gem 'date'
当我运行
bundle install
时,会出现以下错误:

$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'date (>= 0) x86-mingw32' in the gems available on this
machine.
其余的代码是程序的主要计算,所以我没有在这里包括它们

当我在localhost:4567上运行这些文件时,程序运行得非常好

在Heroku中运行应用程序时,我在日志文件中发现以下错误(相当广泛,不确定是否重要):

$heroku logs-t-a young-Dash-4185
←[36m2014-01-20T13:16:18.123135+00:00 heroku[api]:←[0m通过siddhar启用Logplex
thmantri1@gmail.com
←[36m2014-01-20T13:16:18.186772+00:00 heroku[api]:←[0m版本v2由sid创建
dharthmantri1@gmail.com
←[33m2014-01-20T13:16:34+00:00 heroku[段塞编译器]:←[0m Slug编译开始
预计起飞时间
←[33m2014-01-20T13:18:50+00:00 heroku[段塞编译器]:←[0m Slug编译开始
预计起飞时间
←[36m2014-01-20T13:19:05.690086+00:00 heroku[api]:←siddhar提供的[0m腹板比例尺=1
thmantri1@gmail.com
←[36m2014-01-20T13:19:05.758285+00:00 heroku[api]:←[0m由siddhar部署12b370f
thmantri1@gmail.com
←[36m2014-01-20T13:19:05.814824+00:00 heroku[api]:←[0m版本v3由sid创建
dharthmantri1@gmail.com
←[33m2014-01-20T13:19:06+00:00 heroku[段塞编译器]:←[0m段塞编译完成
赫德
←[32m2014-01-20T13:19:08.957680+00:00 heroku[web.1]:←[0m使用c启动过程
ommand bundle exec rackup config.ru-p 34125←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in initialize'
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m from/app/config.ru:innew'
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m from/app/config.ru:in'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:ineval'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in new_from_string'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:inparse_文件'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:内置应用程序和选项
_配置'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:inwrapped_应用程序'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:250:in start'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:141:instart'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/bin/rackup:4:in'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/bin/rackup:23:inload'
←[32m2014-01-20T13:19:11.065193+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/bin/rackup:23:in'
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m/app/test.rb:2:inrequire
“:无法加载这样的文件--nokogiri(LoadError)
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m自/app/sinatratest.rb
:2:在需要时
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:ininstance_eval'
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m from/app/config.ru:1:in
阻挡
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m from/app/test.rb:2:in'
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m from/app/config.ru:1:in
需要
←[32m2014-01-20T13:19:11.064788+00:00应用程序[web.1]:←[0m自/app/sinatratest.rb
:2:in'
←[32m2014-01-20T13:19:11.065003+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in-app'
←[32m2014-01-20T13:19:12.370360+00:00 heroku[web.1]:←[0m进程与sta一起退出
土族1
←[32m2014-01-20T13:19:12.381229+00:00 heroku[web.1]:←[0m状态已从CRA更改
他准备出发了
←[32m2014-01-20T13:19:12.380342+00:00 heroku[web.1]:←[0m状态已从star更改
叮当声
←[32m2014-01-20T13:19:14.369032+00:00 heroku[web.1]:←[0m使用c启动过程
ommandbundle exec rackup config.ru-p 4039←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0m from/app/test.rb:2:in'
←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0m自/app/sinatratest.rb
:2:在需要时
←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0m自/app/sinatratest.rb
:2:in'
←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0m from/app/config.ru:1:in
阻挡
←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0m/app/test.rb:2:inrequire
“:无法加载这样的文件--nokogiri(LoadError)
←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0m from/app/config.ru:1:in
需要
←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:ininstance_eval'
←[32m2014-01-20T13:19:15.709387+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in new_from_string'
←[32m2014-01-20T13:19:15.709187+00:00应用程序[web.1]:←[0m from/app/config.ru:innew'
←[32m2014-01-20T13:19:15.709387+00:00应用程序[web.1]:←[0米自/应用程序/供应商/捆绑/
ruby/2.0.0/gems/rack-1.5。
$ heroku logs -t -a young-dusk-4185
←[36m2014-01-20T13:16:18.123135+00:00 heroku[api]:←[0m Enable Logplex by siddhar
thmantri1@gmail.com
←[36m2014-01-20T13:16:18.186772+00:00 heroku[api]:←[0m Release v2 created by sid
dharthmantri1@gmail.com
←[33m2014-01-20T13:16:34+00:00 heroku[slug-compiler]:←[0m Slug compilation start
ed
←[33m2014-01-20T13:18:50+00:00 heroku[slug-compiler]:←[0m Slug compilation start
ed
←[36m2014-01-20T13:19:05.690086+00:00 heroku[api]:←[0m Scale to web=1 by siddhar
thmantri1@gmail.com
←[36m2014-01-20T13:19:05.758285+00:00 heroku[api]:←[0m Deploy 12b370f by siddhar
thmantri1@gmail.com
←[36m2014-01-20T13:19:05.814824+00:00 heroku[api]:←[0m Release v3 created by sid
dharthmantri1@gmail.com
←[33m2014-01-20T13:19:06+00:00 heroku[slug-compiler]:←[0m Slug compilation finis
hed
←[32m2014-01-20T13:19:08.957680+00:00 heroku[web.1]:←[0m Starting process with c
ommand bundle exec rackup config.ru -p 34125←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in initialize'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/config.ru:innew'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/config.ru:in <main>'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:ineval'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in new_from_string'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:inparse_file'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in build_app_and_options_from
_config'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:inwrapped_app'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:250:in start'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:141:instart'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/bin/rackup:4:in <top (required)>'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/bin/rackup:23:inload'
←[32m2014-01-20T13:19:11.065193+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/bin/rackup:23:in <main>'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m /app/test.rb:2:inrequire
': cannot load such file -- nokogiri (LoadError)
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/sinatratest.rb
:2:in require'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:ininstance_eval'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/config.ru:1:in
block in <main>'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/test.rb:2:in'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/config.ru:1:in
require'
←[32m2014-01-20T13:19:11.064788+00:00 app[web.1]:←[0m from /app/sinatratest.rb
:2:in'
←[32m2014-01-20T13:19:11.065003+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in app'
←[32m2014-01-20T13:19:12.370360+00:00 heroku[web.1]:←[0m Process exited with sta
tus 1
←[32m2014-01-20T13:19:12.381229+00:00 heroku[web.1]:←[0m State changed from cras
hed to starting
←[32m2014-01-20T13:19:12.380342+00:00 heroku[web.1]:←[0m State changed from star
ting to crashed
←[32m2014-01-20T13:19:14.369032+00:00 heroku[web.1]:←[0m Starting process with c
ommandbundle exec rackup config.ru -p 4039←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/test.rb:2:in'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/sinatratest.rb
:2:in require'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/sinatratest.rb
:2:in'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/config.ru:1:in
block in <main>'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m /app/test.rb:2:inrequire
': cannot load such file -- nokogiri (LoadError)
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/config.ru:1:in
require'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:ininstance_eval'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in new_from_string'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/config.ru:innew'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in parse_file'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/bin/rackup:23:inload'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in app'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/bin/rackup:4:in'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in initialize'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:ineval'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in build_app_and_options_from
_config'
←[32m2014-01-20T13:19:15.709187+00:00 app[web.1]:←[0m from /app/config.ru:in'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:250:in start'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:141:instart'
←[32m2014-01-20T13:19:15.709387+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in wrapped_app'
←[32m2014-01-20T13:19:15.709549+00:00 app[web.1]:←[0m from /app/vendor/bundle/
ruby/2.0.0/bin/rackup:23:in'
←[32m2014-01-20T13:19:16.879149+00:00 heroku[web.1]:←[0m Process exited with sta
tus 1
←[32m2014-01-20T13:19:16.890707+00:00 heroku[web.1]:←[0m State changed from star
ting to crashed
←[35m2014-01-20T13:21:08.466196+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/ host=young-dusk-4185.herokuapp.com request_id=1
ef27ceb-7ee2-47f4-9fb7-cbdcc8fab61c fwd="122.170.61.59" dyno= connect= service=
status=503 bytes=
←[35m2014-01-20T13:21:10.429453+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/favicon.ico host=young-dusk-4185.herokuapp.com r
equest_id=5897225e-2ef0-4d79-a779-d025e4631b9e fwd="122.170.61.59" dyno= connect
= service= status=503 bytes=
←[35m2014-01-20T13:21:33.653423+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/favicon.ico host=young-dusk-4185.herokuapp.com r
equest_id=7d0ebe05-3c61-40a5-b68b-8e65aa16ecee fwd="122.170.61.59" dyno= connect
= service= status=503 bytes=
←[35m2014-01-20T13:21:31.920663+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/ host=young-dusk-4185.herokuapp.com request_id=9
d1cfd4c-df22-40f1-bf62-666794740d89 fwd="122.170.61.59" dyno= connect= service=
status=503 bytes=
←[35m2014-01-20T13:22:12.512932+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/ host=young-dusk-4185.herokuapp.com request_id=b
c1c445c-c585-49bd-b1f9-a417a8f92b91 fwd="122.170.61.59" dyno= connect= service=
status=503 bytes=
←[35m2014-01-20T13:22:14.459868+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/favicon.ico host=young-dusk-4185.herokuapp.com r
equest_id=a88c2ad8-1f4f-4010-b485-32456819e054 fwd="122.170.61.59" dyno= connect
= service= status=503 bytes=
←[35m2014-01-20T13:24:10.209495+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/ host=young-dusk-4185.herokuapp.com request_id=3
24a985d-12e3-41a4-bd8a-02dc32f59332 fwd="122.170.61.59" dyno= connect= service=
status=503 bytes=
←[35m2014-01-20T13:24:11.917667+00:00 heroku[router]:←[0m at=error code=H10 desc
="App crashed" method=GET path=/favicon.ico host=young-dusk-4185.herokuapp.com r
equest_id=d940ebe5-4194-415b-96d8-6d7deba77b25 fwd="122.170.61.59" dyno= connect
= service= status=503 bytes=
←[33m2014-01-20T13:31:35+00:00 herokulink_ref,[object Object],slug-compiler:←[0m    Slug compilation timed
out: 900.760266585 seconds.
cannot load such file -- nokogiri