2016-03-20 28 views
2

我想通過Noel Rappin's開始工作非常有前途的「Master Space and Time with JavaScript.」一個障礙源於事實the code最後在2012年9月更新,生態系統已經開始移動。我相信我的問題大部分來自mysql數據庫,使用自制軟件(我相信默認是最新版本)和mysql2 gem版本先生Rappin在12.11,0.3.11版本中使用過。嘗試在Ruby 1.9.3,Rails 3.2.7,mstwjs中加載gem'mysql2'時出現錯誤Noel Rappin教程應用

我已經更新了Gemfile文件,以反映mstwjs Gemfile.lock的文件寶石版本:

source 'http://rubygems.org' 

gem 'rails', '3.2.7' 
gem 'devise', '2.1.2' 

# Bundle edge Rails instead: 
#gem 'rails',  :git => 'git://github.com/rails/rails.git' 

gem 'mysql2', '0.3.11' 

# Asset template engines 
group :assets do 
    gem 'sass-rails', '3.2.5' 
    gem 'coffee-rails', '3.2.2' 
    gem 'uglifier',  '1.2.6' 
end 

gem 'jquery-rails',  '2.0.2' 
gem 'rails-backbone',  '0.7.2' 
#gem 'sprockets_spacely' 

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

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug19', :require => 'ruby-debug' 

group :development do 
    gem 'powder',   '0.1.8' 
    gem 'awesome_print', '1.0.2' 
    gem 'annotate',   '2.5.0' 
end 

group :test, :development do 
    #gem 'guard-rails-assets' 
    #gem 'guard-jasmine-headless-webkit' 
    gem 'jasmine-headless-webkit', '0.8.4' 
    gem 'jasmine',     '1.2.0' 
    gem 'jasminerice',    '0.0.9' 
    gem 'rspec-rails',    '2.11.0' 
end 

然後

$ rbenv local use 1.9.3 
$ brew install mysql2 
$ gem install mysql2 -v ‘0.3.11’ 
$ bundle install 

到目前爲止好! 當我嘗試運行與mstwjs安裝發電機:

$ rake mstwjs:setup --trace 

我遇到了以下錯誤:

rake aborted! 
There was an error while trying to load the gem 'mysql2'. 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/runtime.rb:81:in `rescue in block (2 levels) in require' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/bundler-1.11.2/lib/bundler.rb:99:in `require' 
/Users/benjaminunger/programming/rails/mstwjs/config/application.rb:7:in `<top (required)>' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
/Users/benjaminunger/programming/rails/mstwjs/Rakefile:5:in `<top (required)>' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:65:in `block in run' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:63:in `run' 
/Users/benjaminunger/.rbenv/versions/1.9.3-p551/bin/rake:32:in `<main>' 

任何人有什麼,我做錯了什麼想法?將非常感謝您的見解。

回答

3

我設法做以下修改,以獲得回購工作:

# Gemfile 
gem 'mysql2', '~> 0.3.20' 

bundle update mysql2 

# Create config/initializers/abstract_mysql2_adapter.rb 
class ActiveRecord::ConnectionAdapters::Mysql2Adapter 
    NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY" 
end 

bundle exec rake mstwjs:setup --trace 

得到它的工作。

相關問題