所以。我正在尝试开发一个 Rails 应用程序,并且我正在尝试在 Windows 7 中这样做。这是我所做的:
- 使用 rubyinstaller 安装 Ruby 1.9.3
gem update
gem install rails
gem update
rails new
- 修改了gemfile,替换
sqlite3
为mysql2
- 正确修改 database.yml
bundle install
gem update
- 将mysql添加到我的路径
- 在 ruby bin 中添加了到 libmysql c 连接器的硬链接
到目前为止一切正常,除了当我这样做时rake db:create:all
,这会导致:
rake aborted!
126: The specified module could not be found. - C:/Ruby193/lib/ruby/gems/1.9.1
/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so
C:/Users/username/Documents/workspace/appname/config/application.rb:7:in `<top (
required)>'
C:/Users/username/Documents/workspace/appname/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
什么?
更新:
完整跟踪,应要求:
rake aborted!
126: The specified module could not be found. - C:/Ruby193/lib/ruby/gems/1.9.1
/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.
rb:2:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.
rb:2:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in
`require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in
`<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `
require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `
block (2 levels) in require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `
each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `
block in require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `
each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `
require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:128:in `require
'
C:/Users/mschultz/Documents/workspace/recruit/config/application.rb:7:in `<top (
required)>'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
C:/Users/mschultz/Documents/workspace/recruit/Rakefile:5:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `l
oad'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `l
oad_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:583:in `
raw_load_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:89:in `b
lock in load_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `
standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:88:in `l
oad_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:72:in `b
lock in run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `
standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `r
un'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>
'
C:/Ruby193/bin/rake:23:in `load'
C:/Ruby193/bin/rake:23:in `<main>'
宝石文件:
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'json'
# 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'
# 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 'ruby-debug'