错误:无法在任何来源

时间:2016-01-20 13:54:41

标签: ruby-on-rails ruby

启动就绪项目时遇到问题。 当我用:

启动程序时
  

rails s   我明白了:   无法在任何来源中找到activemodel-3.2.13

     

运行'捆绑安装'安装缺少的宝石

跑完后:

  

捆绑安装

我有:

  

使用原生扩展安装mysql2 0.3.16

     

Gem :: Installer :: ExtensionBuildError:错误:无法构建gem原生扩展。

     

e:/Different/RoR/Ruby22/bin/ruby.exe extconf.rb

     

* extconf.rb失败*

     

由于某些原因无法创建Makefile,可能缺少必要的   库和/或标题。检查mkmf.log文件以获取更多详细信息。你可以   需要配置选项。

     

Gem :: Installer :: ExtensionBuildError:错误:无法构建gem原生扩展。

     

Gem文件将保留在e:/Different/RoR/Ruby22/lib/ruby/gems/2.2.0/gems/debugger-1.6.8中进行检查。

     

结果记录到e:/Different/RoR/Ruby22/lib/ruby/gems/2.2.0/gems/debugger-1.6.8/ext/ruby_debug/gem_make.out

     

安装mysql2(0.3.16)时发生错误,Bundler无法继续。

     

在捆绑之前确保gem install mysql2 -v '0.3.16'成功。

这不是所有日志,只是有错误。

接下来我跑了:

  

gem install mysql2 -v' 0.3.16'

我明白了:

  

错误:安装mysql2时出错:

     

错误:无法构建gem原生扩展。

     

* extconf.rb失败*

     

由于某些原因无法创建Makefile,可能缺少必要的   库和/或标题。检查mkmf.log文件以获取更多详细信息。你可以   需要配置选项。

     

Gem文件将保留在E:/Different/RoR/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.16中进行检查。

     

结果记录到E:/Different/RoR/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.16/ext/mysql2/gem_make.out

那我该怎么办? 之前我还有一个与SSL连接错误相关的错误。所以我无法从http://rubygems.org/加载。但它现在似乎已经消失了。

我的GemFile:

source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'rake', '10.2.1'
# gem 'sqlite3'
gem 'mysql2'
gem 'haml-rails'
gem 'annotate', '>=2.6.0'
gem 'bcrypt-ruby', '3.0.1'
gem "date-input-rails"
gem "nested_form"
gem 'debugger'
#gem "thin"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'bootstrap-sass', '3.0'
  gem 'bootstrap-datepicker-rails'
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

我的GemFile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.13)
      actionpack (= 3.2.13)
      mail (~> 2.5.3)
    actionpack (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
    activerecord (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
    activesupport (3.2.13)
      i18n (= 0.6.1)
      multi_json (~> 1.0)
    annotate (2.6.1)
      activerecord (>= 2.3.0)
      rake (>= 0.8.7)
    arel (3.0.3)
    bcrypt-ruby (3.0.1)
    bootstrap-datepicker-rails (1.3.0.1)
      railties (>= 3.0)
    bootstrap-sass (3.0.0.0)
      sass (~> 3.2)
    builder (3.0.4)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.7.0)
    columnize (0.9.0)
    date-input-rails (0.0.3)
      jquery-ui-rails
      rails (~> 3.2.8)
    debugger (1.6.8)
      columnize (>= 0.3.1)
      debugger-linecache (~> 1.2.0)
      debugger-ruby_core_source (~> 1.3.5)
    debugger-linecache (1.2.0)
    debugger-ruby_core_source (1.3.7)
    erubis (2.7.0)
    execjs (2.0.2)
    haml (4.0.5)
      tilt
    haml-rails (0.4)
      actionpack (>= 3.1, < 4.1)
      activesupport (>= 3.1, < 4.1)
      haml (>= 3.1, < 4.1)
      railties (>= 3.1, < 4.1)
    hike (1.2.3)
    i18n (0.6.1)
    journey (1.0.4)
    jquery-rails (3.1.0)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (4.1.2)
      railties (>= 3.1.0)
    json (1.8.1)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25.1)
    multi_json (1.8.4)
    mysql2 (0.3.16)
    nested_form (0.3.2)
    polyglot (0.3.3)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.13)
      actionmailer (= 3.2.13)
      actionpack (= 3.2.13)
      activerecord (= 3.2.13)
      activeresource (= 3.2.13)
      activesupport (= 3.2.13)
      bundler (~> 1.0)
      railties (= 3.2.13)
    railties (3.2.13)
      actionpack (= 3.2.13)
      activesupport (= 3.2.13)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.2.1)
    rdoc (3.12.2)
      json (~> 1.4)
    sass (3.2.14)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    thor (0.18.1)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.38)
    uglifier (2.4.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)

PLATFORMS
  ruby

DEPENDENCIES
  annotate (>= 2.6.0)
  bcrypt-ruby (= 3.0.1)
  bootstrap-datepicker-rails
  bootstrap-sass (= 3.0)
  coffee-rails (~> 3.2.1)
  date-input-rails
  debugger
  haml-rails
  jquery-rails
  mysql2
  nested_form
  rails (= 3.2.13)
  rake (= 10.2.1)
  sass-rails (~> 3.2.3)
  uglifier (>= 1.0.3)

1 个答案:

答案 0 :(得分:0)

我遵循了这条准则https://medium.com/@frontlineutils/installing-the-mysql2-rubyonrails-gem-on-windows-7-8-a028f44d87f3#.op5rwsf2e

由于我不再使用Windows,我无法再次测试它,但它仍然有用。