安装带有gem的mysql时出现错误“bundler cannot continue…”

cwxwcias  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(328)

我刚学会ruby on rails。我想用mysql代替sqlite3。这是我的配置:
配置/database.yml

  1. default: &default
  2. adapter: mysql
  3. pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  4. timeout: 5000
  5. development:
  6. <<: *default
  7. database: library_development
  8. username: root
  9. password: ""
  10. host: localhost
  11. # Warning: The database defined as "test" will be erased and
  12. # re-generated from your development database when you run "rake".
  13. # Do not set this db to the same as development or production.
  14. test:
  15. <<: *default
  16. database: library_test
  17. username: root
  18. password: ""
  19. host: localhost
  20. production:
  21. <<: *default
  22. database: library_production
  23. username: root
  24. password: ""
  25. host: localhost

gemfile公司

  1. source 'https://rubygems.org'
  2. git_source(:github) { |repo| "https://github.com/#{repo}.git" }
  3. ruby '2.5.1'
  4. # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  5. gem 'rails', '~> 5.2.1'
  6. # Use mysql as the database for Active Record
  7. gem 'mysql', '~> 2.9.1'
  8. gem 'mysql2', '~> 0.3.13'
  9. # Use Puma as the app server
  10. gem 'puma', '~> 3.11'
  11. # Use SCSS for stylesheets
  12. gem 'sass-rails', '~> 5.0'
  13. # Use Uglifier as compressor for JavaScript assets
  14. gem 'uglifier', '>= 1.3.0'
  15. # See https://github.com/rails/execjs#readme for more supported runtimes
  16. gem 'duktape'
  17. # Use CoffeeScript for .coffee assets and views
  18. gem 'coffee-rails', '~> 4.2'
  19. # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
  20. gem 'turbolinks', '~> 5'
  21. # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  22. gem 'jbuilder', '~> 2.5'
  23. # Use Redis adapter to run Action Cable in production
  24. # gem 'redis', '~> 4.0'
  25. # Use ActiveModel has_secure_password
  26. # gem 'bcrypt', '~> 3.1.7'
  27. # Use ActiveStorage variant
  28. # gem 'mini_magick', '~> 4.8'
  29. # Use Capistrano for deployment
  30. # gem 'capistrano-rails', group: :development
  31. # Reduces boot times through caching; required in config/boot.rb
  32. gem 'bootsnap', '>= 1.1.0', require: false
  33. group :development, :test do
  34. # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  35. gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  36. end
  37. group :development do
  38. # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  39. gem 'web-console', '>= 3.3.0'
  40. end
  41. group :test do
  42. # Adds support for Capybara system testing and selenium driver
  43. gem 'capybara', '>= 2.15'
  44. gem 'selenium-webdriver'
  45. # Easy installation and use of chromedriver to run system tests with Chrome
  46. gem 'chromedriver-helper'
  47. end
  48. # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
  49. gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

当我跑的时候 bundle install 它返回错误:
gem文件仍将安装在c:/ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql-2.9.1中以供检查。结果记录到c:/ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/mysql-2.9.1/gem\u make.out
安装mysql(2.9.1)时出错,bundler无法继续。确保 gem install mysql -v '2.9.1' --source 'https://rubygems.org/' 绑定前成功。
在文件中:mysql
请帮忙。谢谢您。

dphi5xsq

dphi5xsq1#

对于使用mysql和rails,您只需要 mysql2 宝石。只需移除 gem 'mysql', '~> 2.9.1' 你应该没事的。

相关问题