我正在升级开发机器,因此我正在使用回购中的项目启动和运行新机器。我安装了所有需要的软件(Ruby,Devkits等),安装了基础gem(bundler等)并在我的项目文件夹中运行bundle install
,产生了这个错误:
> bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from http://rubygems.org/.........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Resolving dependencies.....
Using rake 10.4.2
Using i18n 0.7.0
Using multi_json 1.11.0
Using activesupport 3.2.21
Using builder 3.0.4
Using activemodel 3.2.21
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.3
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.2.3
Using actionpack 3.2.21
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 3.2.21
Using arel 3.0.3
Using tzinfo 0.3.44
Using activerecord 3.2.21
Using activerecord-sqlserver-adapter 3.2.13
Using activeresource 3.2.21
Using authlogic 3.2.0
Using execjs 2.0.2
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb
Gem files will remain installed in C:/Code/vampire_its/ios/.bundle/gems/ruby/2.0.0/gems/json-1.8.2 for inspection.
Results logged to C:/Code/vampire_its/ios/.bundle/gems/ruby/2.0.0/gems/json-1.8.2/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.
我已经研究了一段时间的解决方案并尝试了运行gem install json --verbose
的建议解决方案,它确实正确地安装了json
gem。但是,如果没有运行bundle install
,它就无法正确添加到我的捆绑包中。我甚至跑了bundler install --verbose
但实际上失败了,所以我很难弄清楚发生了什么。我实际上尝试过每一个我可以接受的Ruby版本,并且每个版本都会产生相同的错误,所以它开始在我的机器上看起来像是什么东西,但我不知道什么。
任何帮助将不胜感激。其他文件/信息将包含在下面
版本信息
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby200/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: C:/Ruby200/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby200/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby200/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gempath" => "C:/Ruby200/lib/ruby/gems/2.0.0"
- REMOTE SOURCES:
- https://rubygems.org/
的Gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.21'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3', '~>1.3.7'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
# Rake 0.9.1 breaks Rails
gem 'rake', '>=0.9.2'
group :development do
gem 'rspec-rails', '2.5.0'
gem 'factory_girl', '~> 2.5.0'
gem 'rails-erd', '~>1.1.0', :require => false
gem 'ruby_parser', '~>3.1.1', :require => false # seems to be an implicit dependency of rails-erd
gem 'pry', '~>0.9.12.6'
gem 'pry-rails', '~>0.2.2'
gem 'pry-nav', '~>0.2.3'
gem 'pry-doc', '~>0.5.1'
gem 'xml-simple', '~> 1.1.4'
end
gem "paperclip", "~>2.7.0"
gem "rubyzip", "~>0.9.9"
group :test do
#gem 'capybara', '~> 1.1.4'
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
gem "faker", '1.2.0'
#gem "factory_girl", '~> 2.5.0'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'execjs', '~>2.0.2'
gem 'uglifier', '~>1.3.0'
gem "jquery-rails", '~>3.0.0'
gem 'jquery-ui-rails'
gem 'underscore-rails'
gem "backbone-rails"
end
gem 'authlogic', '~>3.2.0'
gem "declarative_authorization", '~>0.5.6'
gem "sys-filesystem", '1.0.0'
gem "dynamic_form" , '~>1.1.4'
gem 'client_side_validations', '~>3.2.1'
gem "rest-client", '~>1.6.7', :require => "rest_client"
gem "httpclient"
gem 'd3-rails', '~>0.0.5'
gem 'bindata', '~>1.4.5'
gem 'eventmachine', '~>1.0.7', :require => false
if RUBY_PLATFORM =~ /darwin/
#gem "geotrans", "0.0.1" , :path => '../geotrans/pkg/geotrans-0.0.1-x86_64-darwin-12'
elsif RUBY_PLATFORM =~ /(win|w)32$/
gem "geotrans", "0.0.2" , :path => '../geotrans/pkg/geotrans-0.0.2-x86-mingw32'
end
gem "unit_conversion", :path => "./local-gems/unit_conversion"
# RGeo for geographic data support
if RUBY_PLATFORM =~ /(win|w)32$/
gem 'rgeo', "0.3.14" , :path => '../rgeo/pkg/rgeo-0.3.14'
else
gem 'rgeo', '~>0.3.14'
end
# SQL Server support
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter', '~>3.2.10'
# test coverage
if RUBY_VERSION =~ /1.8/
gem 'rcov', '~>1.0.0', :require => false, :group => :test
else
gem 'simplecov', :require => false, :group => :test
end
gem 'delayed_job_active_record', '~>0.3.3'
gem "orderedhash", '~>0.0.6' # binary types uses this
gem "nokogiri", '~> 1.5.9'
gem "js-routes", '~> 0.8.8'
gem "numbers_and_words"
gem "gon", '~> 4.1.1'
gem "bootstrap-sass"
gem 'autoprefixer-rails'
.bundle /配置
---
BUNDLE_BIN: .bundle/bin
BUNDLE_PATH: .bundle/gems
BUNDLE_DISABLE_SHARED_GEMS: '1'
C:\代码\ vampire_its \ ios.bundle \宝石\红宝石\ 2.0.0 \宝石\ JSON-1.8.2 \分机\ JSON \分机\发生器\ gem_make.out
C:/Ruby200/bin/ruby.exe extconf.rb
捆绑配置
> bundle config
DL is deprecated, please use Fiddle
Settings are listed in order of priority. The top value will be used.
build.json
Set for the current user (C:/Users/Micah Cleveland/.bundle/config): "--version"
bin
Set for your local app (C:/Code/vampire_its/ios/.bundle/config): ".bundle/bin"
path
Set for your local app (C:/Code/vampire_its/ios/.bundle/config): ".bundle/gems"
disable_shared_gems
Set for your local app (C:/Code/vampire_its/ios/.bundle/config): "1"
答案 0 :(得分:0)
好像传递--version
标志以修复编译是真正的错误,如evidenced here。
要在bundler中模仿此行为,我们可以使用bundle config
:
每次bundler尝试安装特定的gem时,您都可以使用bundle config为Bundler提供传递给gem安装程序的标志。
...
运行此命令后,每次bundler需要安装mysql gem时,它都会传递你指定的标志。
尝试运行
bundle config build.json --version
bundle install
这应该会导致捆绑程序运行gem install --verbose json
答案 1 :(得分:0)
如果您运行 gem install json --verbose -v '1.8.1'
,您将看到编译器是如何失败的,因为它没有找到一些 C 模块。
似乎重新安装您当前的 ruby
版本(带有这些 C
标头)可能是一个可能的解决方案
检查您当前的 ruby 版本
ruby -v
=> ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-darwin19]
使用 C 模块重新安装 ruby(使用 rbenv
)
CC=gcc rbenv install 2.5.8