0

我关于 Rails 在部署后崩溃的问题。我的部署工作正常。我用rails new myapp --database=postgresql. 然后,我提交我的更改并推送到 heroku。这告诉我:

git push
Fetching repository, done.
Counting objects: 25, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (18/18), done.
Writing objects: 100% (18/18), 1.94 KiB | 0 bytes/s, done.
Total 18 (delta 14), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Using rake (10.1.0)
       Using i18n (0.6.9)
       Using minitest (4.7.5)
       Using multi_json (1.8.2)
       Using atomic (1.1.14)
       Using thread_safe (0.1.3)
       Using tzinfo (0.3.38)
       Using activesupport (4.0.2)
       Using builder (3.1.4)
       Using erubis (2.7.0)
       Using rack (1.5.2)
       Using rack-test (0.6.2)
       Using actionpack (4.0.2)
       Using mime-types (1.25.1)
       Using polyglot (0.3.3)
       Using treetop (1.4.15)
       Using mail (2.5.4)
       Using actionmailer (4.0.2)
       Using activemodel (4.0.2)
       Using activerecord-deprecated_finders (1.0.3)
       Using arel (4.0.1)
       Using activerecord (4.0.2)
       Using coffee-script-source (1.6.3)
       Using execjs (2.0.2)
       Using coffee-script (2.2.0)
       Using thor (0.18.1)
       Using railties (4.0.2)
       Using coffee-rails (4.0.1)
       Using hike (1.2.3)
       Using jbuilder (1.5.3)
       Using jquery-rails (3.0.4)
       Using json (1.8.1)
       Using pg (0.17.0)
       Using bundler (1.3.2)
       Using tilt (1.4.1)
       Using sprockets (2.10.1)
       Using sprockets-rails (2.0.1)
       Using rails (4.0.2)
       Using rdoc (3.12.2)
       Using sass (3.2.12)
       Using sass-rails (4.0.1)
       Using sdoc (0.3.20)
       Using turbolinks (2.0.0)
       Using uglifier (2.3.3)
       Your bundle is complete! It was installed into ./vendor/bundle
       Bundle completed (0.46s)
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Asset precompilation completed (1.92s)
       Cleaning assets
-----> WARNINGS:
       Include 'rails_12factor' gem to enable all platform features
       See https://devcenter.heroku.com/articles/rails-integration-gems for more information.

   You have not declared a Ruby version in your Gemfile.
   To set your Ruby version add this line to your Gemfile:
   ruby '2.0.0'
   # See https://devcenter.heroku.com/articles/ruby-versions for more information.
-----> Discovering process types
       Procfile declares types -> (none)
       Default types for Ruby  -> console, rake, web, worker

-----> Compressing... done, 21.3MB
-----> Launching... done, v10
   http://communityshare-web.herokuapp.com deployed to Heroku

To git@heroku.com:communityshare-web.git
   1488048..2268228  master -> master

所以看起来一切正常,但是当我访问我的 heroku 应用程序时,我得到一个错误页面。

运行后heroku logs,我看到以下内容:

2013-12-12T21:56:18.114338+00:00 heroku[web.1]: State changed from crashed to starting
2013-12-12T21:56:25.558687+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 6442 -e $RAILS_ENV`
2013-12-12T21:56:26.741673+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/inflector/methods.rb:3:in `<top (required)>'
2013-12-12T21:56:26.741673+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/inflector/inflections.rb:1:in `require': cannot load such file -- thread_safe (LoadError)
2013-12-12T21:56:26.741673+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/inflector/inflections.rb:1:in `<top (required)>'
2013-12-12T21:56:26.741673+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/inflector/methods.rb:3:in `require'
2013-12-12T21:56:26.741673+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies/autoload.rb:1:in `require'
4

3 回答 3

1

看起来你需要添加

gem thread_safe

到您的 GemFile 并重新运行

bundle

但是,如果heroku logs --tail运行日志或heroku logs -n 500特定行数有其他错误,应该有助于获得更多详细信息

于 2013-12-12T23:46:18.000 回答
0

我不使用 Rails,但我在 heroku 上的节点上遇到了类似的问题——我忘记将依赖项保存到我的 package.json 文件中,而 heroku 不知道下载它。似乎您在使用主动支持 gem 时遇到了同样的问题。

于 2013-12-12T23:44:05.313 回答
0

仅供参考,您是否将您的 ruby​​ 版本添加到您的 Gemfile 中?
像这样的东西。。

--------- 宝石文件 ---------------------------------

source 'https://rubygems.org'
ruby "2.0.0"

gem list ....

确保你再次捆绑,希望有所帮助..

于 2013-12-14T18:01:00.847 回答