[英]Cant create Ruby on Rails app on Windows - Mysql error
After installing rubyinstaller i tried creating a new mysql app with mysql and i get the below error that has to do with mysql... 安装rubyinstaller后,我尝试用mysql创建一个新的mysql应用程序,我得到以下与mysql有关的错误...
Console : 安慰 :
C:\rails>rails new secret -d mysql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/assets/images/.keep
create app/mailers/.keep
create app/models/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/robots.txt
create test/fixtures
create test/fixtures/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.4)
Using minitest (4.7.5)
Using multi_json (1.7.8)
Using atomic (1.1.12)
Using thread_safe (0.1.2)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.14)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.0)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
C:/RailsInstaller/Ruby1.9.3/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:/RailsInstaller/Ruby1.9.3/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:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/mysql2-0.3.13 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.
3.13/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.
C:\rails>
Error: 错误:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
C:/RailsInstaller/Ruby1.9.3/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:/RailsInstaller/Ruby1.9.3/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:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/mysql2-0.3.13 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.
3.13/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.
C:\rails>
Have you installed mysql (not just the gem)? 你安装了mysql(不仅仅是gem)吗? Need more info to help you out...
需要更多信息来帮助你...
with doing this your issue will be solved 这样做可以解决您的问题
For some reason just specifying the mysql-dir when you install the gem doesn't pick up with other sub directories so you need to set the parameters manually. 出于某种原因,在安装gem时仅指定mysql-dir不会选择其他子目录,因此您需要手动设置参数。
For anyone else experiencing the same problem, I did the following: 对于遇到同样问题的其他人,我做了以下事情:
1) Download the MySql C Connector from: [http://dev.mysql.com/downloads/connector/c/][1] 1)从以下网址下载MySql C连接器:[http://dev.mysql.com/downloads/connector/c/][1]
use archive 32 bit for window 7 64 system NOTE Don't download the installer, download the ARCHIVE for your OS 使用存档32位窗口7 64系统注意不要下载安装程序,下载操作系统的ARCHIVE
2) Extract the file to C:\\mysql-connector 2)将文件解压缩到C:\\ mysql-connector
3) Then ran: 3)然后跑:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\include" --with-mysql-dir="C:\mysql-connector"'
after this its working fine 在此之后它的工作正常
So i Followed this link tutorial http://rorguide.blogspot.gr/2011/03/installing-mysql2-gem-on-ruby-192-and.html 所以我按照这个链接教程http://rorguide.blogspot.gr/2011/03/installing-mysql2-gem-on-ruby-192-and.html
and it fixed my issue 它解决了我的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.