我正在尝试在我的Snow Leopord系统Macbook Pro 13上安装do_mysql,但我不断收到此错误:
n216-160:~ myself$ sudo gem1.9 install do_mysql
Password:
Building native extensions. This could take a while...
ERROR: Error installing do_mysql:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby1.9 extconf.rb
checking for mysql_query() in -lmysqlclient... no
*** 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 …Run Code Online (Sandbox Code Playgroud) 我不知道在ubuntu上安装mysql2 :(
sudo gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/mysql2-0.4.4/ext/mysql2
/usr/bin/ruby2.3 -r ./siteconf20160515-9715-1s2u1sj.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql2-0.4.4 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/gem_make.out
Run Code Online (Sandbox Code Playgroud)
sudo apt-get install libmysqlclient-dev
Lendo listas de pacotes... Pronto
Construindo árvore de dependências
Lendo informação de estado... Pronto
libmysqlclient-dev is already …Run Code Online (Sandbox Code Playgroud) 我使用SQLite作为我的Rails项目但是当我听说Heroku不支持SQLite时,我切换到了MYSQL.
切换我的数据库后,我启动了我的rails服务器"rails s",但它给了我以下错误:
C:\Sites\simple_cms>rails server
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require'
: cannot load such file -- mysql2/2.2/mysql2 (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2
:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `r
equire'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `<
top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:76:in `requ
ire'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:76:in `bloc
k (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:72:in `each
'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:72:in `bloc
k in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:61:in `each
'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:61:in `requ
ire'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler.rb:134:in `require'
from C:/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks
.rb:78:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks
.rb:78:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks
.rb:75:in `tap' …Run Code Online (Sandbox Code Playgroud) 我想在linux上安装一个gem,但它给了我一个错误:
An error occured while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that gem install mysql2 -v '0.3.11' succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
我现在需要做什么?
我很困惑"轻松"使用ruby on rails,因为我已经花了三天时间尝试创建应用程序.
我在site5托管上工作,并尝试创建新的应用程序.一步步:
$ rails new app -d mysql
$ gem install mysql
$ gem install mysql2
Run Code Online (Sandbox Code Playgroud)
之后
$ rake db:create
Run Code Online (Sandbox Code Playgroud)
它报告错误
Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile.
我谷歌它,但仍然无法解决问题.有人可以帮忙吗?
我有一个Rails 3.2.13我想部署的应用程序,但托管服务需要MySQL,而不是我一直在使用的sqlite.
在从转换的过程中sqlite来MySQL,我必须安装红宝石的宝石mysql2,这是给我安装时出现以下错误:
安装mysql2时出错:错误:无法构建gem原生扩展.
我同时尝试了两种bundle install方法gem install mysql2,但是出现了同样的错误信息.
我知道对许多人有用的解决方案是sudo apt-get install libmysql-ruby libmysqlclient-dev,但我在Windows上使用Git Bash ,所以我发现了Windows等价物(@ francois对这个问题的回答).我安装MySQL Server 5.6了安装程序,并运行以下命令:
gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.6\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.6\include"'
Run Code Online (Sandbox Code Playgroud)
根据我的阅读,这应该成功安装'mysql2'ruby gem.但奇怪的是,我仍然有以下错误:
Run Code Online (Sandbox Code Playgroud)Temporarily enhancing PATH to include DevKit... Building native extensions with: '--with-mysql-lib="c:\ProgramFiles\MySQL\MySQL Server 5.6\lib"--with-mysql -include ="c:\ Program Files\MySQL\MySQL Server 5.6\i nclude"'这可能需要一段时间...错误:安装mysql2时出错:ERROR :无法构建gem原生扩展.
Run Code Online (Sandbox Code Playgroud)c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-mysql-lib="c:\Pro gram Files\MySQL\MySQL Server …
我已经提到了以下关于stackoverflow的解决方案,但是我仍然遇到相同的问题:
上面的链接中引用的以下命令未解决该问题:
brew安装mysql
显然,问题仍然存在,返回以下输出:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log …Run Code Online (Sandbox Code Playgroud) 我尝试了类似问题的每个解决方案:
最近,我从ubuntu转移到Mac,我试图在Sierra上安装mysql gem,之后我安装了Ruby,Rails,Mysql,
我也打字brew install mysql,它适用于下载mysql,但不是宝石,所以我的问题不相似.
我输入了这个 mysql --version
我得到了 mysql Ver 14.14 Distrib 5.7.16, for osx10.12 (x86_64) using EditLine wrapper
我试图安装mysql2 gem for rails来构建一个新的应用程序
我输入了这个sudo gem install mysql2并得到了这个错误:
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /Users/mohammed.elias/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/ext/mysql2
/Users/mohammed.elias/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170102-2045-18gcs95.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for …Run Code Online (Sandbox Code Playgroud) 我运行bundle install时遇到问题.我是一名新手.我需要使用mysql作为我的应用程序的数据库我不知道如何解决这个问题有人能给我一些建议吗?
我正在使用ruby 1.9.3和
Rails 3.2.19
我的问题从这里开始当我尝试使用rails generate创建应用程序时
fernando@fernando:~/ruby$ rails new app2 -d mysql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
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/mailers
create app/models
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
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/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 …Run Code Online (Sandbox Code Playgroud)