当最后一部分到达时,我正在尝试在数字海洋中部署 ActiveSupport::MessageEncryptor::InvalidMessage
I'm trying to deploy in the digital ocean, when the final part arrives ActiveSupport::MessageEncryptor::InvalidMessage
我正在尝试在数字海洋中部署,当最后一部分到达时 ~ / .rvm / bin / rvm 2.4.4 来自 bundle exec rake assets: precompile
就returns这个错误 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage 谁能给我一个power已经谢谢了!
00:06 deploy:assets:precompile
01 ~/.rvm/bin/rvm 2.4.4 do bundle exec rake assets:precompile
01 rake aborted!
01 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:183:in `_decrypt'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:79:in `decrypt'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:42:in `read'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:21:in `read'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:33:in `config'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:38:in `options'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/core_ext/module/delegation.rb:271:in `method_missin…
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:433:in `secret_key_base'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:176:in `key_generator'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/globalid-0.4.1/lib/global_id/railtie.rb:26:in `block (2 levels) in <class:Railtie>'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `each'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:75:in `block in <module:Finisher>'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
01 /var/www/jrpescados/releases/20180606215329/config/environment.rb:5:in `<main>'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in req…
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with…
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
01 /home/deploy/.rvm/rubies/ruby-2.4.4/bin/bundle:30:in `block in <main>'
01 /home/deploy/.rvm/rubies/ruby-2.4.4/bin/bundle:22:in `<main>'
01 /home/deploy/.rvm/gems/ruby-2.4.4/bin/ruby_executable_hooks:15:in `eval'
01 /home/deploy/.rvm/gems/ruby-2.4.4/bin/ruby_executable_hooks:15:in `<main>'
尝试将此添加到您的 deploy.rb
文件
before "deploy:assets:precompile", "bundle:install"
我遇到了你的问题并解决了。
问题的原因是 rails 5.2.0 无法获取您的 secret_key_base
。您可以在 Gemfile
中使用 gem dotrails
,然后在本地计算机的终端中键入命令:bundle install
。
然后将.env
添加到远程机器rails应用程序的shared/
目录,其内容为SECRET_KEY_BASE = 'YOURSECRETKEY'
。同时将 .env
添加到 config/deploy.rb
文件,例如
append :linked_files, ".env"
温馨提醒:将 .env
添加到您的 .gitignore
文件中。
最后,通过 capistrano 再次部署您的应用程序。
干杯,
我正在尝试在数字海洋中部署,当最后一部分到达时 ~ / .rvm / bin / rvm 2.4.4 来自 bundle exec rake assets: precompile 就returns这个错误 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage 谁能给我一个power已经谢谢了!
00:06 deploy:assets:precompile
01 ~/.rvm/bin/rvm 2.4.4 do bundle exec rake assets:precompile
01 rake aborted!
01 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:183:in `_decrypt'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:79:in `decrypt'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:42:in `read'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:21:in `read'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:33:in `config'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:38:in `options'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/core_ext/module/delegation.rb:271:in `method_missin…
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:433:in `secret_key_base'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:176:in `key_generator'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/globalid-0.4.1/lib/global_id/railtie.rb:26:in `block (2 levels) in <class:Railtie>'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `each'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:75:in `block in <module:Finisher>'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
01 /var/www/jrpescados/releases/20180606215329/config/environment.rb:5:in `<main>'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in req…
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with…
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
01 /var/www/jrpescados/shared/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
01 /home/deploy/.rvm/rubies/ruby-2.4.4/bin/bundle:30:in `block in <main>'
01 /home/deploy/.rvm/rubies/ruby-2.4.4/bin/bundle:22:in `<main>'
01 /home/deploy/.rvm/gems/ruby-2.4.4/bin/ruby_executable_hooks:15:in `eval'
01 /home/deploy/.rvm/gems/ruby-2.4.4/bin/ruby_executable_hooks:15:in `<main>'
尝试将此添加到您的 deploy.rb
文件
before "deploy:assets:precompile", "bundle:install"
我遇到了你的问题并解决了。
问题的原因是 rails 5.2.0 无法获取您的 secret_key_base
。您可以在 Gemfile
中使用 gem dotrails
,然后在本地计算机的终端中键入命令:bundle install
。
然后将.env
添加到远程机器rails应用程序的shared/
目录,其内容为SECRET_KEY_BASE = 'YOURSECRETKEY'
。同时将 .env
添加到 config/deploy.rb
文件,例如
append :linked_files, ".env"
温馨提醒:将 .env
添加到您的 .gitignore
文件中。
最后,通过 capistrano 再次部署您的应用程序。
干杯,