小编Pro*_*ton的帖子

Rails:ActiveSupport::MessageEncryptor::InvalidMessage

请帮助我,我已经完成了 Rails 教程的 11 章,将我的应用程序部署到 heroku(在本地运行良好)并且它一直崩溃。我正在使用 rails 5.2.2 在执行命令 $heroku run rails console 后,我收到了这个:

Traceback (most recent call last):
    92: from /app/bin/rails:9:in `<main>'
    91: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
    90: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
    89: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
    88: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    87: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    86: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    85: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    84: from /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    83: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<main>'
    82: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/command.rb:46:in `invoke'
    81: from /app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/command/base.rb:65:in `perform'
    80: from /app/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
     6: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/encrypted_configuration.rb:21:in `read'
     5: …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-5.2

23
推荐指数
5
解决办法
2万
查看次数

Kubernetes:一个或多个容器没有资源限制 - VS Code Kubernetes 工具中的警告

创建 pod-definition.yml 文件后。

apiVersion: v1
kind: Pod
metadata:
    name: myapp-pod
    labels: 
      app: myapp
      type: server
spec:
    containers:
        - name: nginx-container
          image: nginx
Run Code Online (Sandbox Code Playgroud)

linter 发出此警告。

One or more containers do not have resource limits - this could starve other processes

kubernetes visual-studio-code

22
推荐指数
2
解决办法
5501
查看次数

您的用户帐户不允许安装到系统RubyGems

我在运行命令

bundle install
Run Code Online (Sandbox Code Playgroud)

在项目文件夹中.在某些项目文件夹中,它将产生错误,在其他项目文件夹中,它不会产生错误.错误是:

您的用户帐户不允许安装到系统RubyGems

我知道这可以通过遵循建议的建议来解决:

bundle install --path vendor/bundle
Run Code Online (Sandbox Code Playgroud)

我的问题是为什么行为不一致?

ruby rubygems ruby-on-rails bundler gemfile

18
推荐指数
4
解决办法
2万
查看次数

Ruby:LoadError - 找不到类 Digest::SHA1 的库 - 摘要/sha1

运行pod install时安装时遇到问题yoga。好像是我的ruby环境有问题?

$ pod install
Analyzing dependencies
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `Permission-Camera` from `../node_modules/react-native-permissions/ios/Camera.podspec`
Fetching podspec for `Permission-LocationAlways` from `../node_modules/react-native-permissions/ios/LocationAlways.podspec`
Fetching podspec for `Permission-LocationWhenInUse` from `../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec`
Fetching podspec for `RNPermissions` from `../node_modules/react-native-permissions`
Fetching podspec for `React` from `../node_modules/react-native/`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Run Code Online (Sandbox Code Playgroud)

命令

/Users/User/.rbenv/versions/2.3.1/bin/pod install
Run Code Online (Sandbox Code Playgroud)

   CocoaPods : 1.5.3
        Ruby : ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
    RubyGems : 2.5.1
        Host : Mac OS X 10.15.1 (19B88)
       Xcode : …
Run Code Online (Sandbox Code Playgroud)

ruby ios rbenv cocoapods podfile

18
推荐指数
2
解决办法
2万
查看次数

ReactJS:Pngquant 构建失败,请确保安装了 libpng-dev

我正在尝试设置一个反应项目。它有很多依赖项,并且在下载其中一个模块时会引发此错误。这是在窗户上。

pngquant 构建失败,请确保安装了 libpng-dev

输出: ?无法获得本地颁发者证书
pngquant 预构建测试
从源代码编译失败
pngquant 预构建测试成功通过
错误:pngquant 无法构建,请确保已安装 libpng-dev

npm reactjs

16
推荐指数
2
解决办法
1万
查看次数

Rails:Webpacker 4.2 在 /app/public/packs/manifest.json heroku 中找不到应用程序

我有点难住了。我的本地 rails 应用程序与 webpacker 4.2 配合得很好并做出反应,但是在部署到生产环境时can't find application in /app/public/packs/manifest.json出现了奇妙的错误。

这是我尝试过的:

  • 尝试添加/删除 javascript 包标签的 turbo 链接详细信息。
  • 删除了 javascript 包含标签(不确定这是否有帮助)
  • 确保我使用的是最新的 webpacker 4.2
  • 运行 rake assets:clean && rake assets:precompile 在 heroku 上手动预编译只是为了确保事情正在构建。

我是否错过了构建步骤或生产中会导致这种情况的东西?还需要检查什么?

服务器错误:

2019-12-03T15:18:19.022024+00:00 app[web.1]: I, [2019-12-03T15:18:19.021952 #30]  INFO -- : [aa0374eb-bab1-40cc-b40b-6ae3d195e07d] Completed 500 Internal Server Error in 112ms (ActiveRecord: 30.4ms | Allocations: 21296)
2019-12-03T15:18:19.023103+00:00 app[web.1]: F, [2019-12-03T15:18:19.023029 #30] FATAL -- : [aa0374eb-bab1-40cc-b40b-6ae3d195e07d]
2019-12-03T15:18:19.023107+00:00 app[web.1]: [aa0374eb-bab1-40cc-b40b-6ae3d195e07d] ActionView::Template::Error (Webpacker can't find application in /app/public/packs/manifest.json. Possible causes:
2019-12-03T15:18:19.023109+00:00 app[web.1]: 1. …
Run Code Online (Sandbox Code Playgroud)

javascript ruby-on-rails webpack webpacker

16
推荐指数
3
解决办法
2万
查看次数

Docker:解决“deb.debian.org”的临时失败

我有一个Rails应用程序,我想在Ubuntu服务器上使用Docker部署它。我已经为应用程序设置了 Dockerfile,现在我想查看其容器中的conf。nginx

我运行以下命令以nginx交互模式启动容器:

docker run -i -t nginx:latest /bin/bash
Run Code Online (Sandbox Code Playgroud)

现在我正在尝试安装nano编辑器,以便使用以下命令查看nginx配置 ( nginx.conf)的配置:

apt-get update
apt-get install nano
export TERM=xterm
Run Code Online (Sandbox Code Playgroud)

但是,当我运行第一个命令时apt-get update,出现以下错误:

Err:1 http://security.debian.org/debian-security buster/updates InRelease
  Temporary failure resolving 'security.debian.org'
Err:2 http://deb.debian.org/debian buster InRelease                  
  Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
  Temporary failure resolving 'deb.debian.org'
Reading package lists... Done    
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease  Temporary …
Run Code Online (Sandbox Code Playgroud)

ubuntu debian nginx docker

16
推荐指数
8
解决办法
3万
查看次数

Heroku:在 /app/config/storage.yml 中找不到 Active Storage 配置(运行时错误)

我的应用程序部署到 Heroku,但每次都崩溃。我不知道为什么。我已经在 Heroku 上为生产中的应用程序设置了 Carrierwave、雾和 aws,然后就好了。尝试按照相同的步骤操作,但我收到了 h10 错误代码。在 rails 控制台中,它特别指出:

/app/vendor/bundle/ruby/2.3.0/gems/activestorage-5.2.1/lib/active_storage/engine.rb:76:in `block (2 levels) in ': 找不到 Active Storage 配置 / app/config/storage.yml(运行时错误)

storage.yml 

test:
  service: Disk
  root: <%= Rails.root.join("tmp/storage") %>

local:
  service: Disk
  root: <%= Rails.root.join("storage") %>


# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
amazon:
  service: S3
  access_key_id: "S3_KEY"
  secret_access_key: "S3_SECRET"
  region: "us-east-1"
  bucket: "books4reviews"
Run Code Online (Sandbox Code Playgroud)

生产.rb

  config.active_storage.service = :amazon 
Run Code Online (Sandbox Code Playgroud)

载波

CarrierWave.configure do |config|

config.fog_provider = 'fog/aws'

config.fog_credentials = {
  provider: 'AWS',
  aws_access_key_id: ENV['S3_KEY'],
  aws_secret_access_key: …
Run Code Online (Sandbox Code Playgroud)

crash ruby-on-rails heroku amazon-web-services rails-activestorage

15
推荐指数
2
解决办法
3169
查看次数

Rails 6:Zeitwerk::NameError 不从模块加载类

我有一个看起来像这样的文件

#app/services/account/authenticate/base.rb
module Account
  module Authenticate
    AuthenticateError = Class.new(StandardError)

    class Base < ::Account::Base
      def self.call(*attrs)
        raise NotImplementedError
      end
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

现在当我运行代码时rails c出现错误

> ::Account::Authenticate::AuthenticateError
=> NameError (uninitialized constant Account::Authenticate::AuthenticateError)
> ::Account::Authenticate.constants
=> [:Base, :ViaToken]
Run Code Online (Sandbox Code Playgroud)

所以 rails 没有看到 AuthenticateError 类。但是当我从这个文件夹创建一个嵌套类时

=> Account::Authenticate::ViaToken
> ::Account::Authenticate.constants
=> [:Base, :AuthenticateError, :ViaToken]
Run Code Online (Sandbox Code Playgroud)

AuthenticateError 类现在可见

> ::Account::Authenticate::AuthenticateError
=> Account::Authenticate::AuthenticateError
Run Code Online (Sandbox Code Playgroud)

这个问题的解决方案是创建一个单独的文件authenticate_error.rb,它从一开始就可以工作,但这个解决方案对我来说并不理想。是否有任何解决方案可以预加载所有类或 smth?

(Ruby 2.6 和 Rails 6.0.0.rc2)

ruby ruby-on-rails

15
推荐指数
2
解决办法
8231
查看次数

Docker:安装docker时如何解决ubuntu中的公钥错误

运行以下命令以在 Ubuntu 服务器中安装 docker 和 kubernetes 时,我收到以下错误消息。

root@master:/home/ubuntu# add-apt-repository \
>   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
>   $(lsb_release -cs) \
>   stable"
Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu bionic-security InRelease
**Err:2 https://download.docker.com/linux/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8**
Reading package lists... Done
W: GPG error: https://download.docker.com/linux/ubuntu bionic InRelease: The following signatures couldn't be verified because the …
Run Code Online (Sandbox Code Playgroud)

ubuntu docker

15
推荐指数
8
解决办法
1万
查看次数