我刚刚用 ruby 开始一个项目(在 Windows 上),当我运行 'rails server' 时,我有这个 ince ,essage:
C:\Sites\rails_projects\first_app>rails 服务器 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql-2.9.1-x86-mingw32/lib /mysql.rb:6:在
require': cannot load such file -- mysql/mysql_api (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql-2.9.1-x8 6-mingw32/lib/mysql.rb:6:in
救援中来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql-2.9.1-x8 6-mingw32/lib/mysql.rb:2:in<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/ lib/bundler/runtime.rb:72:in
require' 来自 C :/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:inblock (2 levels) in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/ lib/bundler/runtime.rb:70:in
each' 来自 C:/RailsInstaller/Ruby1.9.3/lib /ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:inblock in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/ lib/bundler/runtime.rb:59:in
each' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/ gems/bundler-1.3.5/lib/bundler/runtime.rb:59:inrequire' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/ lib/bundler.rb:132:in
需要'来自 C:/Sites/rails_projects/first_app/config/application.rb:7:in<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:53:in
需要'来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:53:inblock in <top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:50:in
tap'来自 C:/RailsInstaller/ Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:50:in<top (required)>' from script/rails:6:in
require' from script/rails:6:in `'
当然,我错过了什么。这是我的 Gemfile:来源“ https://rubygems.org ”
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'bundler'
gem 'sqlite3'
gem 'mysql'
gem 'geocode'
gem 'gmaps4rails'
gem 'railties'
# 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 'debugger'
因为我刚刚开始,所以我没有 ruby 代码文件(或者我有一个,当你创建一个新的铁路项目时生成的那个)。
提前致谢,
感谢您的快速回答,但不幸的是我遇到了同样的错误:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l ib/mysql2/mysql2.rb:2:in
require': 126: Le module spécifié est introuvable. - C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/ lib/mysql2/1.9/mysql2.so (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2/mysql2.rb:2:in
'来自 C:/RailsInstaller/ Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:inrequire' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2.rb:9:in
'来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/ gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:inrequire' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/ lib/bundler/runtime.rb:72:in
block (2 levels) in require' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9 .1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:ineach' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/ lib/bundler/runtime.rb:70:in
block in require' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler- 1.3.5/lib/bundler/runtime.rb:59:ineach' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/ lib/bundler/runtime.rb:59:in
require' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb :132:在require' from C:/Sites/rails_projects/first_app/config/application.rb:7:in
'来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:53:inrequire' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:53:in
block in '来自 C:/RailsInstaller/ Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:50:intap' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:50:in
' 来自 script/rails:6:inrequire' from script/rails:6:in
'
My files : Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'bundler'
# gem 'sqlite3'
gem 'mysql2', '~> 0.3.11'
gem 'geocode'
gem 'gmaps4rails'
gem 'railties'
# 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 'debugger'
数据库.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'mysql2'
development:
adapter: mysql2
database: db/development.mysql2
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
database: db/test.mysql2
pool: 5
timeout: 5000
production:
adapter: mysql2
database: db/production.mysql2
pool: 5
timeout: 5000
再次感谢你的帮助,