【问题标题】:"Bundle install" keeps asking me to install individual gems“捆绑安装”一直要求我安装单个 gem
【发布时间】:2016-12-14 16:22:27
【问题描述】:

我在 Ubuntu 14.04 Linux 上运行 Ruby v 2.3……

myusername@mymachine:~$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

最近似乎每当我从远程脚本运行“捆绑安装”时,我总是被要求单独安装 gems。当我在 Mac Sierra 上进行本地开发时,不会发生这种情况。注意下面的错误信息

localhost:runtrax davea$ sh /opt/scripts/pushrt "Corrected processing with regards to RockNRoll site."
[master 0def218] Corrected processing with regards to RockNRoll site.
 11 files changed, 108 insertions(+), 46 deletions(-)
Counting objects: 21, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 3.80 KiB | 0 bytes/s, done.
Total 21 (delta 18), reused 0 (delta 0)
To git@gitlab.com:myusername/myproject.git
   891a010..0def218  master -> master
Counting objects: 21, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 3.80 KiB | 0 bytes/s, done.
Total 21 (delta 18), reused 0 (delta 0)
remote: Master ref received.  Deploying master branch to production...
remote: Warning: the running version of Bundler (1.13.5) is older than the version that created the lockfile (1.13.6). We suggest you upgrade to the latest version of Bundler by   running `gem install bundler`.
remote: Fetching gem metadata from https://rubygems.org/........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Using rake 11.3.0
remote: Using Ascii85 1.0.2
remote: Using i18n 0.7.0
remote: Using json 1.8.3
remote: Using minitest 5.9.1
remote: Using thread_safe 0.3.5
remote: Using builder 3.2.2
remote: Using erubis 2.7.0
remote: Using mini_portile2 2.1.0
remote: Using rack 1.6.4
remote: Using mime-types-data 3.2016.0521
remote: Using arel 6.0.3
remote: Using addressable 2.4.0
remote: Using afm 0.2.2
remote: Using execjs 2.7.0
remote: Using sass 3.4.22
remote: Using byebug 9.0.6
remote: Using chronic 0.10.2
remote: Using chunky_png 1.3.7
remote: Using coffee-script-source 1.10.0
remote: Using thor 0.19.1
remote: Using multi_json 1.12.1
remote: Using rb-fsevent 0.9.7
remote: Using ffi 1.9.14
remote: Using concurrent-ruby 1.0.2
remote: Using tilt 2.0.5
remote: Using debug_inspector 0.0.2
remote: Using unf_ext 0.0.7.2
remote: Using multipart-post 2.0.0
remote: Using hashery 2.1.2
remote: Using hashie 3.4.6
remote: Using turbolinks-source 5.0.0
remote: Using jwt 1.5.6
remote: Using kgio 2.10.0
remote: Using net-http-digest_auth 1.4
remote: Using net-http-persistent 2.9.4
remote: Using ntlm-http 0.1.1
remote: Using webrobots 0.1.2
remote: Using multi_xml 0.5.5
remote: Using net-telnet 0.1.1
remote: Using oauth 0.5.1
remote: Using ruby-rc4 0.1.5
remote: Using ttfunk 1.4.0
remote: Using pg 0.19.0
remote: Using puma 3.6.0
remote: Using bundler 1.13.5
remote: Using raindrops 0.17.0
remote: Using rubyzip 1.2.0
remote: Using ruby-ole 1.2.12
remote: Using socksify 1.7.0
remote: Using tor 0.1.2
remote: Using will_paginate 3.1.5
remote: Using tzinfo 1.2.2
remote: Using nokogiri 1.6.8.1
remote: Using rack-test 0.6.3
remote: Using mime-types 3.1
remote: Using autoprefixer-rails 6.5.1
remote: Using uglifier 3.0.2
remote: Using compass-import-once 1.0.5
remote: Using whenever 0.9.7
remote: Using coffee-script 2.4.1
remote: Using compass-core 1.0.3
remote: Using rb-inotify 0.9.7
remote: Using sprockets 3.7.0
remote: Using unf 0.1.4
remote: Using faraday 0.9.2
remote: Using omniauth 1.3.1
remote: Using turbolinks 5.0.1
remote: Using pdf-reader 1.4.0
remote: Using postgresql 1.0.0
remote: Using unicorn 5.1.0
remote: Using spreadsheet 1.1.4
remote: Using tor_requests 0.6.0
remote: Using activesupport 4.2.7.1
remote: Using loofah 2.0.3
remote: sudo: no tty present and no askpass program specified
remote: Using w3c_validators 1.2
remote: Using mail 2.6.4
remote: Using bootstrap-sass 3.3.7
remote: Using compass 1.0.3
remote: Using listen 3.0.8
remote: Using domain_name 0.5.20160826
remote: Using oauth2 1.2.0
remote: Using omniauth-oauth 1.1.0
remote: Using rails-deprecated_sanitizer 1.0.3
remote: Using globalid 0.3.7
remote: Using activemodel 4.2.7.1
remote: Using jbuilder 2.6.0
remote: Using pundit 1.1.0
remote: Using spring 2.0.0
remote: Using rails-html-sanitizer 1.0.3
remote: Bundler::GemspecError: Could not read gem at
remote: /usr/local/rvm/gems/ruby-2.3.0/cache/roo-2.5.1.gem. It may be corrupted.
remote: An error occurred while installing roo (2.5.1), and Bundler cannot continue.
remote: Make sure that `gem install roo -v '2.5.1'` succeeds before bundling.
remote: rake aborted!
remote: Bundler::GemNotFound: Your bundle is locked to roo (2.5.1), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed    sources, that means the author of roo (2.5.1) has removed it. You'll need to update your bundle to a different version of roo (2.5.1) that hasn't been removed in order to  install.
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/definition.rb:179:in `rescue in specs'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/definition.rb:173:in `specs'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/definition.rb:233:in `specs_for'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/definition.rb:222:in `requested_specs'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/runtime.rb:118:in `block in definition_method'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/runtime.rb:19:in `setup'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler.rb:99:in `setup'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/setup.rb:20:in `<top (required)>'
remote: /home/rails/myproject/config/boot.rb:3:in `<top (required)>'
remote: /home/rails/myproject/config/application.rb:1:in `<top (required)>'
remote: /home/rails/myproject/Rakefile:4:in `<top (required)>'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
remote: /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
remote: /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
remote: Bundler::GemNotFound: Could not find roo-2.5.1 in any of the sources
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/spec_set.rb:95:in `block in materialize'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/spec_set.rb:88:in `map!  
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/spec_set.rb:88:in `materialize'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/definition.rb:174:in `specs'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/definition.rb:233:in `specs_for'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/definition.rb:222:in `requested_specs'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/runtime.rb:118:in `block in definition_method'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/runtime.rb:19:in `setup'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler.rb:99:in `setup'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/bundler-1.13.5/lib/bundler/setup.rb:20:in `<top (required)>'
remote: /home/rails/myproject/config/boot.rb:3:in `<top (required)>'
remote: /home/rails/myproject/config/application.rb:1:in `<top (required)>'
remote: /home/rails/myproject/Rakefile:4:in `<top (required)>'
remote: /usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
remote: /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
remote: /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
remote: (See full trace by running task with --trace)

我还需要配置什么才能使“捆绑安装”正常工作,就像在我的本地计算机上一样?

【问题讨论】:

  • 你能显示你的 Gemfile 和 /opt/scripts/pushrt 吗?我怀疑您的 Gemfile 中定义的组或传递给捆绑器的选项可能存在问题。

标签: ruby-on-rails ruby-on-rails-4 rubygems installation bundle


【解决方案1】:

一开始它告诉你 gemfile 是由旧版本的 bundler 创建的。尝试按照它的建议更新捆绑器:

gem install bundler

您也遇到了 roo gem 的问题。它说它可能已损坏。再次尝试安装:

gem install roo -v '2.5.1'

然后再次运行捆绑安装。

【讨论】:

  • 我尝试使用“gem install bundler”升级捆绑器,但这并没有解决问题。我意识到我可以运行命令“gem install roo -v '2.5.1'”,但每次我添加一个新的 gem(roo 只是一个例子)时,我都会被要求单独安装它。我没有被要求在我的 Mac 上执行此操作。这是为什么呢?
  • 可能是权限问题。你得到的另一个错误是这一行:“remote: sudo: no tty present and no askpass program specified”。显然这意味着您需要输入密码才能安装,但捆绑器不输入密码,所以它只是跳转。尝试在远程命令行“sudo visudo”并将其内容更改为“username ALL = NOPASSWD:”。这应该会阻止它询问密码,并且捆绑程序应该能够运行。
  • visudo 命令会打开 sudoers 的配置文件并让您更改权限和密码。通常它设置为始终要求输入密码,但由于捆绑器有问题,您可以将其关闭。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-29
  • 2013-09-02
  • 1970-01-01
  • 2017-03-11
  • 1970-01-01
相关资源
最近更新 更多