2012-08-28 84 views
2

我搜索了四周,但我一直未能找到有效的答案。Ruby on rails:rake中止壞文件描述符

我對此完全陌生,所以當你回答時,就像我是一個孩子一樣解釋......或者像我是一塊西蘭花一樣解釋。如果你想要我安裝一些東西,告訴我該寫什麼。

嗯,我想按照這個http://guides.fatfreecrm.com/Setup-Microsoft-Windows.html和我來這裏,我應該寫 rake db:create RAILS_ENV=production 一個點,我得到的是這樣的:(我也做了「創業板安裝mysql2」,我已經安裝耙如在教程中,並沒有看到任何問題)

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 
+0

您真的想要生產環境嗎? (RAILS_ENV =生產)即現場?如果沒有,然後刪除那一點。然後檢查config/database.yml並確保您已正確配置環境。 – TomDunning

+1

是否提供了mysql的服務?你有沒有嘗試runnig只耙分貝:創建? –

+0

我也面臨同樣的問題。我正在嘗試這種開發模式。當我創建一個新的應用程序並嘗試執行該命令時,它會成功運行。但在我的情況下,我已經從SVN中檢出項目,並嘗試執行rake db:migrate,並面臨同樣的問題。 – Rohit

回答

1

我有相同的問題,並花了兩個小時後修復它。也許它會幫助你。 所以這裏的步驟,這導致我解決這個問題

  1. 我假設你正在運行32位的MySQL,因爲64位+ 32位mysql的問題可以是別的東西
  2. 確保是MYSQL.DLL compatiable安裝寶石(我有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中

摘要:對我來說,在p軌道之間不兼容的問題mysql2寶石和我的機器上安裝的那個不一致