【问题标题】:What is the syntax to specifing multiple gem constraints in a Rails Gemfile?在 Rails Gemfile 中指定多个 gem 约束的语法是什么?
【发布时间】:2017-10-07 01:34:40
【问题描述】:

多个依赖项的 Gemfile 的正确语法是什么?

尝试使用 Capistrano 时,我收到一条错误消息:

cap aborted!
NotImplementedError: unsupported key type `ssh-ed25519'
net-ssh requires the following gems for ed25519 support:
 * rbnacl (>= 3.2, < 5.0)
 * rbnacl-libsodium, if your system doesn't have libsodium installed.
 * bcrypt_pbkdf (>= 1.0, < 2.0)
See https://github.com/net-ssh/net-ssh/issues/478 for more information
Gem::LoadError : "can't activate rbnacl (< 5.0, >= 3.2.0), already activated rbnacl-5.0.0. Make sure all dependencies are added to Gemfile."

我将以下内容放入我的 Gemfile:

gem 'rbnacl', '>= 3.2, < 5.0', :require => false
gem 'rbnacl-libsodium', :require => false
gem 'bcrypt_pbkdf', '>= 1.0, < 2.0', :require => false

gem(和 req false)以前在 Gemfile 中。

当我添加版本要求时,bundle install 出现以下错误:

[!] There was an error parsing `Gemfile`: Illformed requirement [">= 3.2, < 5.0"]. Bundler cannot continue.

 #  from /Users/myname/MySite/Gemfile:70
 #  -------------------------------------------
 #    gem 'capistrano-maintenance', '~> 1.0', :require => false
 >    gem 'rbnacl', '>= 3.2, < 5.0', :require => false
 #    gem 'rbnacl-libsodium', :require => false
 #  -------------------------------------------

【问题讨论】:

    标签: ruby-on-rails capistrano gemfile


    【解决方案1】:

    使用数组或直接列出来:

    gem 'rbnacl', ['>= 3.2', '< 5.0']
    gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
    

    【讨论】:

      【解决方案2】:
      gem install 'rbnacl:<5.0' rbnacl-libsodium 'bcrypt_pbkdf:<2.0'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-05-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-11-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多