工作下面是我已經試圖找到答案的地方: tutorials point,stackoverflow,another stack overflow和the official guide。如何獲得Ruby on Rails的(Rails的V4,紅寶石v1.9.3)與MySQL
我仍然不知道我做錯了什麼。在我正確配置database.yml之後,我嘗試創建項目,這是我得到的錯誤:
「請更新您的路徑以包含構建工具或從'http://rubyinstaller.org/downloads'下載DevKit 並按照說明進行操作 在「http://github.com/oneclick/rubyinstaller/wiki/Development-Kit」
在安裝mysql2(0.3.13)和捆紮機無法繼續出錯。 確保gem install mysql2 -v '0.3.13'
綁定前的成功「。
爲什麼我找不到mysql2 v0.3.13?
操作系統:Windows 7 的Rails:4.0.0 紅寶石:1.9.3 的devkit安裝
,我也遇到過錯誤 $ bundle exec rails s Could not locate Gemfile
$ bundle Bundler::GemfileNotFound
`$ gem install mysql2
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
c:/Ruby193/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=c:/Ruby193/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
extconf.rb:37:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)
Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13 for inspection.`
我已經安裝了最新版本的MySQL是5.x或6。我不知道如何找出來。 Rails總是說它找不到mysql2寶石。 – Casey
這就是我的Gemfile中的內容:'#使用mysql作爲活動記錄的數據庫 gem'mysql2''。當我運行捆綁這是輸出:'Bundler :: GemfileNotFound' – Casey
關閉終端並再次打開。 cd到正確的目錄。檢查紅寶石版本('ruby -v')。檢查rails版本「bundle exec rails -v」。檢查'Gemfile'是否存在。運行'bundle'。運行'bundle exec rails s'。如果其中任何一項檢查失敗,請編輯問題並告訴我們確切的問題。複製粘貼您看到的實際錯誤。 – Zabba