bundle 想要安装旧版本的 gem--- 我如何找出原因?
bundle wants to install an old version of a gem---how do I find out why?
我正在尝试重建一个 rails 应用程序,该应用程序曾经运行(最后一次检查是在 12 月左右),但在某些系统升级期间停止运行。当我 运行 bundle install
时,大多数 gems 看起来都很好,但随后它尝试安装 json 1.8.0 但失败了。
我从网上搜索得知 json 1.8.0 与 ruby 2.2.0 不兼容,所以我尝试安装较新的版本——构建和安装都很好。但是当我重新 运行 bundle install
时,它再次尝试构建 json 1.8.0,但失败了。我目前的问题是,我完全无法找到为什么 想要 安装 json 1.8.0;它本身并没有列在我的 Gemfile 中,当我为我的 Gemfile 中的每个 gem 手动 运行 sudo gem install XXX
时,安装 运行 就好了。所以我什至无法弄清楚它有什么 json 1.8.0 作为依赖项!
I can 运行 gem dependency json -R
并获取已成功安装的列表,这取决于我拥有的 json 版本,但当然它只列出依赖版本 >=
或 ~>
某些版本的 gem,这些版本对更高版本很满意。
我假设我必须在某处编辑一个 gemfile,告诉它不要使用 json 1.8.0 而是使用 '~> 1.8.0' 或类似的东西。有人知道我应该在哪里寻找吗?
这是我在 Gemfile 中列出的 gem:
gem 'isbn_validation'
gem 'rails', '4.0.0'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 3.1.3'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'sdoc', require: false
gem 'devise', '~> 3.2.4'
gem 'cancan', '~> 1.6.10'
gem 'activerecord-session_store'
gem 'paperclip', '~> 4.2.0'
gem dependency json -R
的输出:
Gem json-1.8.1
Used by
activesupport-4.2.3 (json (>= 1.7.7, ~> 1.7))
loofah-2.0.3 (json (>= 0, development))
sprockets-2.12.4 (json (>= 0, development))
uglifier-2.7.1 (json (>= 1.8.0))
Gem json-1.8.2
permutation (>= 0, development)
sdoc (~> 0.3.16, development)
Used by
activesupport-4.2.3 (json (>= 1.7.7, ~> 1.7))
loofah-2.0.3 (json (>= 0, development))
sprockets-2.12.4 (json (>= 0, development))
uglifier-2.7.1 (json (>= 1.8.0))
Gem json-1.8.3
permutation (>= 0, development)
sdoc (~> 0.3.16, development)
Used by
activesupport-4.2.3 (json (>= 1.7.7, ~> 1.7))
loofah-2.0.3 (json (>= 0, development))
sprockets-2.12.4 (json (>= 0, development))
uglifier-2.7.1 (json (>= 1.8.0))
这里是 bundle install
:
输出的略微删节版本
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.4
Using minitest 4.7.5
Using multi_json 1.7.7
Using atomic 1.1.10
[... omitting many ...]
Using isbn_validation 1.1.1
Using jbuilder 1.4.2
Using jquery-rails 3.1.3 (was 3.0.2)
Installing json 1.8.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby -r ./siteconf20150822-13426-pdmmtu.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
In file included from /usr/include/stdio.h:27:0,
from /usr/include/ruby-2.2.0/ruby/defines.h:26,
from /usr/include/ruby-2.2.0/ruby/ruby.h:29,
from /usr/include/ruby-2.2.0/ruby.h:33,
from ../fbuffer/fbuffer.h:5,
from generator.c:1:
/usr/include/features.h:328:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
^
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
Makefile:237: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /tmp/bundler20150822-13426-vxbo1gjson-1.8.0/gems/json-1.8.0 for inspection.
Results logged to /tmp/bundler20150822-13426-vxbo1gjson-1.8.0/extensions/x86_64-linux/2.2.0/json-1.8.0/gem_make.out
An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.
我在 Linux 系统上; ruby -v
是 ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
,bundle -v
是 Bundler version 1.10.6
。
您的 Gemfile.lock
是捆绑器在 运行 宁 bundle install
时实际检查的内容,至少在您第一次为给定项目安装 运行 捆绑器之后(请参阅this Whosebug post)。检查该文件,看看是否有任何问题。您也可以尝试删除它并重新 运行ning bundle install
,或者只是 运行 bundle update
安装所有 gems 的最新版本,如果您不关心特定的版本。
我正在尝试重建一个 rails 应用程序,该应用程序曾经运行(最后一次检查是在 12 月左右),但在某些系统升级期间停止运行。当我 运行 bundle install
时,大多数 gems 看起来都很好,但随后它尝试安装 json 1.8.0 但失败了。
我从网上搜索得知 json 1.8.0 与 ruby 2.2.0 不兼容,所以我尝试安装较新的版本——构建和安装都很好。但是当我重新 运行 bundle install
时,它再次尝试构建 json 1.8.0,但失败了。我目前的问题是,我完全无法找到为什么 想要 安装 json 1.8.0;它本身并没有列在我的 Gemfile 中,当我为我的 Gemfile 中的每个 gem 手动 运行 sudo gem install XXX
时,安装 运行 就好了。所以我什至无法弄清楚它有什么 json 1.8.0 作为依赖项!
I can 运行 gem dependency json -R
并获取已成功安装的列表,这取决于我拥有的 json 版本,但当然它只列出依赖版本 >=
或 ~>
某些版本的 gem,这些版本对更高版本很满意。
我假设我必须在某处编辑一个 gemfile,告诉它不要使用 json 1.8.0 而是使用 '~> 1.8.0' 或类似的东西。有人知道我应该在哪里寻找吗?
这是我在 Gemfile 中列出的 gem:
gem 'isbn_validation'
gem 'rails', '4.0.0'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 3.1.3'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'sdoc', require: false
gem 'devise', '~> 3.2.4'
gem 'cancan', '~> 1.6.10'
gem 'activerecord-session_store'
gem 'paperclip', '~> 4.2.0'
gem dependency json -R
的输出:
Gem json-1.8.1
Used by
activesupport-4.2.3 (json (>= 1.7.7, ~> 1.7))
loofah-2.0.3 (json (>= 0, development))
sprockets-2.12.4 (json (>= 0, development))
uglifier-2.7.1 (json (>= 1.8.0))
Gem json-1.8.2
permutation (>= 0, development)
sdoc (~> 0.3.16, development)
Used by
activesupport-4.2.3 (json (>= 1.7.7, ~> 1.7))
loofah-2.0.3 (json (>= 0, development))
sprockets-2.12.4 (json (>= 0, development))
uglifier-2.7.1 (json (>= 1.8.0))
Gem json-1.8.3
permutation (>= 0, development)
sdoc (~> 0.3.16, development)
Used by
activesupport-4.2.3 (json (>= 1.7.7, ~> 1.7))
loofah-2.0.3 (json (>= 0, development))
sprockets-2.12.4 (json (>= 0, development))
uglifier-2.7.1 (json (>= 1.8.0))
这里是 bundle install
:
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.4
Using minitest 4.7.5
Using multi_json 1.7.7
Using atomic 1.1.10
[... omitting many ...]
Using isbn_validation 1.1.1
Using jbuilder 1.4.2
Using jquery-rails 3.1.3 (was 3.0.2)
Installing json 1.8.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby -r ./siteconf20150822-13426-pdmmtu.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
In file included from /usr/include/stdio.h:27:0,
from /usr/include/ruby-2.2.0/ruby/defines.h:26,
from /usr/include/ruby-2.2.0/ruby/ruby.h:29,
from /usr/include/ruby-2.2.0/ruby.h:33,
from ../fbuffer/fbuffer.h:5,
from generator.c:1:
/usr/include/features.h:328:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
^
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
Makefile:237: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /tmp/bundler20150822-13426-vxbo1gjson-1.8.0/gems/json-1.8.0 for inspection.
Results logged to /tmp/bundler20150822-13426-vxbo1gjson-1.8.0/extensions/x86_64-linux/2.2.0/json-1.8.0/gem_make.out
An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.
我在 Linux 系统上; ruby -v
是 ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
,bundle -v
是 Bundler version 1.10.6
。
您的 Gemfile.lock
是捆绑器在 运行 宁 bundle install
时实际检查的内容,至少在您第一次为给定项目安装 运行 捆绑器之后(请参阅this Whosebug post)。检查该文件,看看是否有任何问题。您也可以尝试删除它并重新 运行ning bundle install
,或者只是 运行 bundle update
安装所有 gems 的最新版本,如果您不关心特定的版本。