我正在使用 Ruby 2.5.1 和 Rails 5.2.0。我运行了 rails s -e production
命令,出现了以下错误:
/home/roy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:206:in `rescue in_decrypt': ActiveSupport::MessageEncryptor::InvalidMessage
(ActiveSupport::MessageEncryptor::InvalidMessage)
我该如何正确地完成这个任务?
编辑: 每当我尝试使用编辑凭据文件时,都会出现相同的错误。
EDITOR="nano --wait" bin/rails credentials:edit
我也意识到我还没有创建生产数据库,所以我尝试使用
RAILS_ENV=production bundle exec rails db:reset
(我知道db:reset有些冗余,但尝试创建、迁移和填充服务器时应该能起作用)
可悲的是我得到了同样类型的错误(InvalidMessage error)
Unsupported rails environment for compass
rake aborted!
ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
/home/roy/apps/myappname/config/environment.rb:5:in `<main>'
/home/roy/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/roy/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Caused by:
OpenSSL::Cipher::CipherError:
/home/roy/apps/myappname/config/environment.rb:5:in `<main>'
/home/roy/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/roy/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
EDITOR="nano --wait" bin/rails credentials:edit
来编辑加密凭据时,它会给我相同的错误,就像我在帖子中看到的那样。 - royketelaarmaster.key
吗? - AntonTkachov