2015-09-10 3 views
-1

Я добавил mysql gem в свой файл gem, но когда я запустил bundle install, он показывает мне ошибку ниже.Не удается установить Mysql gem на сервере Ubuntu

An error occurred while installing mysql (2.9.1), and Bundler cannot continue. Make sure that `gem install mysql -v '2.9.1'` succeeds before bundling. 

Я устанавливаю этот драгоценный камень на моей Ubuntu machine.I я использую Рельсы версии 4.2.0 и рубин 2.1.7.I я объяснял мю Gemfile ниже.

Gemfile:

source 'https://rubygems.org' 
ruby '2.1.7' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.0' 
# Use postgresql as the database for Active Record 
gem 'pg', '~> 0.18.2' 
gem 'mysql', '~> 2.9.1' 
gem 'postgres_ext', '~> 2.4.1' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails', '~> 4.0.3' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks', '~> 2.5.3' 
gem 'jquery-turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0', group: :doc 

gem 'bootstrap-sass', '~> 3.3.4' 
gem 'font-awesome-sass', '~> 4.2.0' 

gem 'devise', '~> 3.4.1' 
gem 'devise_invitable', '~> 1.5.0' 
gem 'omniauth-facebook', '~> 2.0' 
gem 'omniauth-google-oauth2', '~> 0.2.6' 
gem 'simple_form', '~> 3.1.0' 
gem 'cancancan', '~> 1.9.2' 

gem 'will_paginate', '~> 3.0.7' 
gem 'will_paginate-bootstrap', '~> 1.0.1' 

# Use this only for admin related filters 
gem 'ransack', '~> 1.5.1' 

# Enums: single & multi value, integrates with ActiveRecord, simple_form 
gem 'enumerize', '~> 0.9.0' 

# Image processing 
gem 'mini_magick', '~> 4.0.1' 

# File uploads 
gem 'fog', '~> 1.27' #, require: 'fog/aws/storage' 
gem 'carrierwave', '~> 0.10.0' 

# Phone number validation 
gem 'phonelib', '~> 0.4.0' 

# Nested forms 
gem 'cocoon', '~> 1.2.6' 

gem 'combined_time_select', '~> 1.0.1' 

# For file uploads 
gem 'jquery-fileupload-rails', '~> 0.4.4' 

# jquery light gallery 
gem 'light_gallery_rails', git: 'https://github.com/stNicolaas/light-gallery-rails.git' 

# Background processing 
gem 'que', '~> 0.9.2' 

gem 'rails-timeago', '~> 2.11.1' 

gem 'listjs-rails', '~> 1.1.1' 

gem 'selectize-rails', '~> 0.12.0' 
gem 'client_side_validations', git: 'https://github.com/DavyJonesLocker/client_side_validations.git' 
gem 'client_side_validations-simple_form', git: 'https://github.com/DavyJonesLocker/client_side_validations-simple_form.git' 

gem 'validate_url', '~> 1.0.0' 

gem 'friendly_id', '~> 5.1.0' 

gem 'bootstrap-slider-rails', git: 'https://github.com/stationkeeping/bootstrap-slider-rails.git' 

gem 'recaptcha', '~> 0.4.0', require: 'recaptcha/rails' 

gem 'google-analytics-turbolinks', '~> 0.0.4' 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 

    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 

    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
    gem 'spring' 

    # Exceute 'rspec' on command line to run tests 
    gem 'rspec-rails', '~> 3.0' 
    gem 'rspec-its' 

    # Fixtures replacement 
    gem "factory_girl_rails", "~> 4.0" 

    # Fake data 
    gem "faker" 

    # rails environment variables 
    gem 'figaro', '~> 1.1.1' 
end 

group :development do 
    # Annotate models 
    gem "annotate", "~> 2.6.5" 
end 

group :test do 
    # See http://robots.thoughtbot.com/how-we-test-rails-applications > Database Cleaner 
    gem 'database_cleaner', "~> 1.3.0" 

    gem 'capybara', "~> 2.4.0" 
end 

group :production do 
    gem 'mandrill_dm', '~> 1.2.0' 
end 

Пожалуйста, помогите мне решить эту ошибку.

ответ

2

Попробуйте

sudo apt-get install libmysqlclient-dev 

Если это не поможет, вставить здесь ошибку вы получаете.

+0

Ваш ответ помог мне, но после запуска сервера он показывает, что этот «Миграции не ожидаются». Чтобы устранить эту проблему, запустите: bin/rake db: migrate RAILS_ENV = development' error.Can вы поможете мне решить эту ошибку. – satya

+0

Это не ошибка. Вы управляете своей базой данных через миграцию, вы можете прочитать о них здесь: http://edgeguides.rubyonrails.org/active_record_migrations.html Просто запустите эту команду в консоли, находясь у корня вашего проекта. –

Смежные вопросы