首页 > 解决方案 > 将 Rails 应用程序部署到谷歌云时出错

问题描述

我正在尝试按照本教程将 Rails 应用程序部署到谷歌云。该应用程序使用postresql数据库。在部署新版本的步骤中,我必须运行以下命令:

bundle exec bin/rails assets:precompile

但我收到了这个错误:

[dry-types] Dry::Types.module is deprecated and will be removed in the next major version
Use Dry.Types() instead. Beware, it exports strict types by default, for old behavior use Dry.Types(default: :nominal). See more options in the changelog
/home/<user>/.rvm/rubies/ruby-2.4.9/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:81:in `require'
rails aborted!
NoMethodError: undefined method `member_types' for #<Dry::Types::Hash::Constructor:0x0000562258ee3c18>
/home/<user>/.rvm/gems/ruby-2.4.9/gems/dry-types-0.15.0/lib/dry/types/constructor.rb:147:in `method_missing'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/dry-struct-0.5.1/lib/dry/struct/class_interface.rb:306:in `schema'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/dry-struct-0.5.1/lib/dry/struct/class_interface.rb:193:in `check_schema_duplication'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/dry-struct-0.5.1/lib/dry/struct/class_interface.rb:133:in `attributes'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/dry-struct-0.5.1/lib/dry/struct/class_interface.rb:113:in `attribute'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator_text/types/sentence.rb:8:in `<class:Sentence>'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator_text/types/sentence.rb:3:in `<module:Types>'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator_text/types/sentence.rb:2:in `<module:TranslatorText>'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator_text/types/sentence.rb:1:in `<top (required)>'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator_text/types.rb:30:in `require_relative'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator_text/types.rb:30:in `<top (required)>'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator-text.rb:4:in `require_relative'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/translator-text-0.1.0/lib/translator-text.rb:4:in `<top (required)>'
/home/<user>/projects/consul/config/application.rb:7:in `<top (required)>'
/home/<user>/projects/consul/Rakefile:4:in `require'
/home/<user>/projects/consul/Rakefile:4:in `<top (required)>'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/railties-5.0.7.2/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/railties-5.0.7.2/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/<user>/.rvm/gems/ruby-2.4.9/gems/railties-5.0.7.2/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<top (required)>'
/home/<user>/.rvm/rubies/ruby-2.4.9/bin/bundle:30:in `block in <main>'
/home/<user>/.rvm/rubies/ruby-2.4.9/bin/bundle:22:in `<main>'
/home/<user>/.rvm/gems/ruby-2.4.9/bin/ruby_executable_hooks:24:in `eval'
/home/<user>/.rvm/gems/ruby-2.4.9/bin/ruby_executable_hooks:24:in `<main>'
(See full trace by running task with --trace)

有谁知道我该如何解决?

谢谢!

标签: ruby-on-railsgoogle-cloud-platform

解决方案


看来您的错误与 library 有关dry-types。根据错误:

[dry-types] Dry::Types.module 已弃用,将在下一个主要版本中删除

似乎正在使用的此版本将被删除,您需要对其进行更新。我建议您尝试一下并检查一下,因为这似乎会影响 Rails,Google Cloud Platform 正在使用它来部署您的应用程序。

更多信息dry-types可以在图书馆的 Github 存储库中找到

让我知道这些信息是否对您有帮助!


推荐阅读