尝试运行捆绑安装时出现“安全策略”错误

时间:2021-08-27 00:20:03

I have recently been having a lot of trouble with my rubies.

我最近在红宝石上遇到了很多麻烦。

Now whenever I try and run bundle install on my projects I get the following error:

现在每当我尝试在我的项目上运行bundle install时,我都会收到以下错误:

 bundle install
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-        1.3.5/lib/bundler/rubygems_integration.rb:172:in `security_policies': uninitialized constant Gem::Security::Policies (NameError)
from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/cli.rb:175:in `<class:CLI>'
from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/cli.rb:6:in `<module:Bundler>'
from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/cli.rb:5:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:18:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/bundle:23:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/bundle:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

I have tried reinstalling rubies, I have tried rvm get head and gem update --system

我已经尝试重新安装红宝石,我已经尝试过rvm get head和gem update --system

I have also tried uninstalling and re-installing OpenSSL, through rvm package and brew install.

我还尝试通过rvm包和brew install卸载并重新安装OpenSSL。

And I have tried completely imploding RVM and starting again, but none of this seems to work. This seemed to happen after I shifted to Mavericks.

我已经尝试完全破坏RVM并重新开始,但这似乎都没有用。这似乎发生在我转移到小牛队之后。

Does anybody out there have an idea what might be happening? I have been at this for 3 days...

有没有人知道可能会发生什么?我已经在这3天了...

Edit:

I am having the same issue with all these rubies:

我对所有这些红宝石都有同样的问题:

  • 1.9.3
  • 2.0.0-p195
  • 2.0.0-p247
  • 2.1.0-preview1

3 个解决方案

#1


1  

When running bundle install on a new rvm gemset running Ruby 2.0 and Rails 4.0 on OSX Mavericks, I was receiving the same error:

在OSX Mavericks上运行Ruby 2.0和Rails 4.0的新rvm gemset上运行bundle install时,我收到了同样的错误:

gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:172:in `security_policies':    uninitialized constant Gem::Security::Policies (NameError)

Running 'brew install openssl', then 'rvm reinstall 2.0' worked for me.

运行'brew install openssl',然后'rvm reinstall 2.0'为我工作。

#2


2  

Assuming you're using brew...

假设你正在使用brew ...

  1. Run brew doctor to check the current state and perform any steps it recommends.

    运行brew doctor检查当前状态并执行它建议的任何步骤。

  2. Run rvm list and note which versions of ruby are installed. Remove the offending ruby version with rvm remove 2.0.x where 'x' is the minor revision you are working with, or run rvm remove 2.0 to remove them all.

    运行rvm list并记下安装了哪些版本的ruby。使用rvm remove 2.0.x删除有问题的ruby版本,其中'x'是您正在使用的次要修订版,或运行rvm remove 2.0将其全部删除。

  3. Now upgrade to the latest rvm, rvm get stable.

    现在升级到最新的rvm,rvm得到稳定。

  4. Let rvm install dependencies automatically by running rvm autolibs enable. This will allow rvm to install whatever it needs during the ruby installation, including openssl. It will use brew, as I am assuming here, but will also use fink or macports if they are installed instead. In the past I have had problems with brew and macports both installed.

    让rvm通过运行rvm autolibs enable自动安装依赖项。这将允许rvm在ruby安装期间安装它需要的任何东西,包括openssl。它将使用brew,正如我在这里假设的那样,但是如果安装了它们也将使用fink或macports。在过去,我遇到了brew和macports都安装的问题。

  5. Install the latest ruby via rvm, rvm install 2.0.

    通过rvm,rvm install 2.0安装最新的ruby。

Bundler should now work.

Bundler现在应该工作了。

#3


0  

Have you tried using the --trust-policy=[] option with bundle install? To Apply the Rubygems security policy named policy, where policy is one of HighSecurity, MediumSecurity, LowSecurity, or NoSecurity. More - http://bundler.io/v1.3/man/bundle-install.1.html

您是否尝试过使用bundle安装的--trust-policy = []选项?要应用名为policy的Rubygems安全策略,其中policy是HighSecurity,MediumSecurity,LowSecurity或NoSecurity之一。更多 - http://bundler.io/v1.3/man/bundle-install.1.html

#1


1  

When running bundle install on a new rvm gemset running Ruby 2.0 and Rails 4.0 on OSX Mavericks, I was receiving the same error:

在OSX Mavericks上运行Ruby 2.0和Rails 4.0的新rvm gemset上运行bundle install时,我收到了同样的错误:

gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:172:in `security_policies':    uninitialized constant Gem::Security::Policies (NameError)

Running 'brew install openssl', then 'rvm reinstall 2.0' worked for me.

运行'brew install openssl',然后'rvm reinstall 2.0'为我工作。

#2


2  

Assuming you're using brew...

假设你正在使用brew ...

  1. Run brew doctor to check the current state and perform any steps it recommends.

    运行brew doctor检查当前状态并执行它建议的任何步骤。

  2. Run rvm list and note which versions of ruby are installed. Remove the offending ruby version with rvm remove 2.0.x where 'x' is the minor revision you are working with, or run rvm remove 2.0 to remove them all.

    运行rvm list并记下安装了哪些版本的ruby。使用rvm remove 2.0.x删除有问题的ruby版本,其中'x'是您正在使用的次要修订版,或运行rvm remove 2.0将其全部删除。

  3. Now upgrade to the latest rvm, rvm get stable.

    现在升级到最新的rvm,rvm得到稳定。

  4. Let rvm install dependencies automatically by running rvm autolibs enable. This will allow rvm to install whatever it needs during the ruby installation, including openssl. It will use brew, as I am assuming here, but will also use fink or macports if they are installed instead. In the past I have had problems with brew and macports both installed.

    让rvm通过运行rvm autolibs enable自动安装依赖项。这将允许rvm在ruby安装期间安装它需要的任何东西,包括openssl。它将使用brew,正如我在这里假设的那样,但是如果安装了它们也将使用fink或macports。在过去,我遇到了brew和macports都安装的问题。

  5. Install the latest ruby via rvm, rvm install 2.0.

    通过rvm,rvm install 2.0安装最新的ruby。

Bundler should now work.

Bundler现在应该工作了。

#3


0  

Have you tried using the --trust-policy=[] option with bundle install? To Apply the Rubygems security policy named policy, where policy is one of HighSecurity, MediumSecurity, LowSecurity, or NoSecurity. More - http://bundler.io/v1.3/man/bundle-install.1.html

您是否尝试过使用bundle安装的--trust-policy = []选项?要应用名为policy的Rubygems安全策略,其中policy是HighSecurity,MediumSecurity,LowSecurity或NoSecurity之一。更多 - http://bundler.io/v1.3/man/bundle-install.1.html