2014-02-08 149 views
1

編程,ruby,rails,sql等新手。隨着視頻教程,但遇到此錯誤。任何幫助讚賞。無法啓動rails服務器。無法找到特定模塊

C:\sites\simple_cms>rails s 
c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in `requir 
e': 126: The specified module could not be found. - c:/ruby200-x64/lib/ruby/ge 
ms/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so (LoadError) 

     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb 
:8:in `<top (required)>' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:76:in `require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:76:in `block (2 levels) in require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:72:in `each' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:72:in `block in require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:61:in `each' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler/runtime.rb:61:in `require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun 
dler.rb:132:in `require' 
     from C:/sites/simple_cms/config/application.rb:7:in `<top (required)>' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:74:in `require' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:74:in `block in <top (required)>' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:71:in `tap' 
     from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co 
mmands.rb:71:in `<top (required)>' 
     from bin/rails:4:in `require' 
     from bin/rails:4:in `<main>' 

C:\sites\simple_cms> 
+0

首先在'c:\ sites \ simple_cms'中嘗試'bundle install',然後重試。讓我知道這是否工作 – Abdo

+0

謝謝。試過,但現在得到這個錯誤:c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:在'requir e':193: %1不是有效的Win32應用程序。 - c:/ ruby​​200-x64/lib/ruby​​/gems/2 .0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so(LoadError) from c:/ ruby​​200- x64/lib/ruby​​/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb :8:在' from c:/ ruby​​200-x64/lib/ruby /gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun dler/runtime.rb:76:在'require'..... – Jarg

+0

mysql2 gem需要一些TLC工作窗戶(至少,當我嘗試時是一種痛苦)。顯然[這個人](http://stackoverflow.com/a/19023107/877472)設法解決它。也許它也可以幫助你。 –

回答

0

我們需要從頭這裏開始:

  1. 使用Windows安裝程序從http://rubyinstaller.org/downloads/
  2. 安裝Ruby安裝捆綁: gem install bundler
  3. 對於Windows的MySQL,我認爲你需要的的devkit。從http://rubyinstaller.org/downloads/
  4. 獲取與您的操作系統相匹配的電源請確保您的電腦上安裝了mysql。
  5. 確保mysql2 gem安裝正確。如果gem install mysql2未正確安裝,則可能需要如下內容:gem install mysql2 -- --with-mysql-dir="C:\mysql\bin";改變c:\mysql\bin的位置,可以在步驟安裝mysql 4
  6. 安裝導軌:gem install rails
  7. 轉到目錄C:\網站\ simple_cms和類型:bundle install
  8. 現在試圖啓動您的服務器:rails s

Windows上的Rails開發有了很大的改進,但如果你真的想保持最新並避免將來出現一些奇怪的問題(尤其是在支持gem的時候),我建議你使用Ubuntu。如果你沒有另一臺電腦或者不想進行雙啓動,你可以免費安裝VirtualBoxhttps://www.virtualbox.org/wiki/Downloads),並運行Ubuntu。

+0

感謝您的幫助。關於從頭開始。我需要先卸載所有內容嗎?其次,我怎麼知道我需要什麼版本ie。 32位或64位?我知道即時通訊運行64位操作系統,但我很確定我的CPU是64位啓用的,但是當我查看系統屬性時,它只表示64位操作系統,並沒有提到我的CPU。這是否表明它沒有運行64位,這可能與錯誤有關嗎?我想我正在運行所有ruby和sql軟件的64位版本。運行32位的所有內容會更容易嗎? – Jarg

+0

如果您正在運行64位操作系統,那麼您最好使用64位安裝。我不認爲你需要卸載任何東西。安裝人員應該注意這一點。如果你還有問題,歡迎循環返回=) – Abdo

+0

謝謝,我只是安裝了虛擬盒子並運行了ubuntu。我現在如何在Ubuntu上執行此操作?我不知道從哪裏開始真的大聲笑。就像我必須下載所有內容一樣,我如何訪問命令提示符。和Ubuntu上的命令是不同的沒有? – Jarg