简体   繁体   English

使用ActionCable将Rails应用程序部署到Heroku

[英]Deploy rails app with ActionCable to Heroku

I created simple online chat using ROR and ActionCable. 我使用ROR和ActionCable创建了简单的在线聊天。 And then try to deploy app to heroku. 然后尝试将应用程序部署到heroku。

But I have a strange error after deploy and app wont run. 但是部署和应用程序无法运行后,我遇到了一个奇怪的错误。

Heroku build log: Heroku构建日志:

   .........
   Bundle completed (0.70s)
   Cleaning up the bundler cache.
   Could not detect rake tasks
   ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
   and using the production group of your Gemfile.
   rake aborted!
   TypeError: nil is not a symbol
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `module_function'
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `<module:ActionCable>'
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:22:in `<top (required)>'
   .........

action_cable.rb from github: 来自github的action_cable.rb:

  # Singleton instance of the server
  module_function def server       #line #29
    @server ||= ActionCable::Server::Base.new
  end

Gemfile 的Gemfile

gem 'actioncable', github: 'rails/actioncable'

At local machine all work fine. 在本地计算机上一切正常。 Any ideas? 有任何想法吗?

Source, if it will help: https://github.com/kokosko/chat/ 来源,如果有帮助的话: https : //github.com/kokosko/chat/

This sounds like you were running ruby 2.0 or lower. 听起来您运行的是ruby 2.0或更低版本。 Rails 5.0 requires ruby 2.2. Rails 5.0需要ruby 2.2。

The precise cause for this error message is that in previous versions of ruby 此错误消息的确切原因是在先前版本的ruby中

def foo
end

returns nil, whereas as of ruby 2.1, it will return :foo . 返回nil,而从ruby 2.1开始,它将返回:foo The code you posted relies on this change. 您发布的代码取决于此更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM