4

我已经四处搜索,但我无法找到有效的答案。

我对此完全陌生,所以当你回答时,请像我是一个孩子一样解释......或者像我是一块西兰花一样解释。如果你想让我安装一些东西,告诉我要写什么。

好吧,我正在尝试遵循这个http://guides.fatfreecrm.com/Setup-Microsoft-Windows.html并且我已经到了我应该写的地方, rake db:create RAILS_ENV=production 我得到的只是这个:(我已经完成了“gem install mysql2”,我已经按照教程安装了 rake,没有发现任何问题)

C:\RailsInstaller\fat_free_crm>rake db:create RAILS_ENV=production --trace   

** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create rake aborted! Bad file descriptor 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:312:in `query'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:312:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:629:in
`configure_connecti on'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:169:in
`initialize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/li
b/active_record/connection_adapters/mysql2_adapter.rb:16:in
`mysql2_connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:309:in
`new_connection '
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:319:in
`checkout_new_c onnection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:241:in
`block (2 level s) in checkout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:236:in
`loop'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:236:in
`block in check out'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in
`mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:233:in
`checkout'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:96:in `block
in connec tion'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in
`mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:95:in
`connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:404:in
`retrieve_conne ction'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_specification.rb:170:in
`retri eve_connection'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/connection_adapters/abstract/connection_specification.rb:144:in
`conne ction'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:83:in `rescue in create_database'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:51:in `create_database'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:40:in `block (3 levels) in <top
(required)>'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:40:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/acti
ve_record/railties/databases.rake:40:in `block (2 levels) in <top
(required)>'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:205:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:205:in `block in execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:200:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:200:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:158:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in
`mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:151:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:144:in `invoke'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:116:in `invoke_task'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:88:in `top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:66:in `block in run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:63:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in
`<top (required)>' C:/RailsInstaller/Ruby1.9.3/bin/rake:23:in `load'
C:/RailsInstaller/Ruby1.9.3/bin/rake:23:in `<main>' Tasks: TOP =>
db:create
4

1 回答 1

1

我有同样的问题并在花了两个小时后修复了它。也许它也会帮助你。所以这里是引导我解决问题的步骤

  1. 我假设您正在运行 32 位 mysql,因为 64 位 + 32 位 mysql 的问题可能是其他问题
  2. 确保 mysql.dll 与已安装的 gem 兼容(我有 mysql2)
  3. 为避免问题从http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick下载
  4. 将 mysql.dll 复制到您的 ruby​​/bin

总结:对我来说是rails mysql2 gem和我机器上安装的那个不兼容的问题

于 2012-10-29T12:39:02.930 回答