Installing the bundle for a MySQL Rail Application - ruby-on-rails

When I say bundle install after some time I get the error:
Results logged to
/Users/JonyIve/.rvm/gems/ruby-1.9.3-p362#railsbabak/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.11), and Bundler cannot
continue. Make sure that gem install mysql2 -v '0.3.11' succeeds
before bundling.
So I do what it say, I run this command :
gem install mysql2 -v '0.3.11'
And then again I run Bundle Install but again I get the same error.
Where should I begin looking at to fix this issue?
And here is how my GemFile looks like:
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
#START:mysql
group :production do
gem 'mysql2'
end
#END:mysql
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
#START_HIGHLIGHT
gem 'capistrano'
#END_HIGHLIGHT
# To use debugger
# gem 'debugger'
gem 'will_paginate', '~> 3.0'

Reason for this error could be due to lack of mysql header, so make sure you have installed mysql headers properly.
For Ubuntu/Linux flavor, Use following command to install MySQL client and development package
sudo apt-get install mysql-client libmysqlclient-dev
For mac OS:
http://www.djangoapp.com/blog/2011/07/24/installation-of-mysql-server-on-mac-os-x-lion/
Regards!

Related

An error occurred while installing mysql2 (0.3.11)

I am a rails beginner,and I get a demo from https://github.com/rubytaiwan/jobs.ruby.tw
but when I try to run this demo,I got an error.
I run follow
bundle
I got the error
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
but I can sure I have install mysql2
and the Gemfile is
source 'https://rubygems.org'
ruby "1.9.3"
gem 'rails', '~> 3.2.12'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'devise', '~>2.1.3'
gem 'mysql2'
gem "babosa"
gem "rails_autolink"
gem "settingslogic"
gem "seo_helper"
gem 'open_graph_helper'
gem 'google_plus_helper'
gem 'exception_notification'
gem "mobile-fu"
gem 'capistrano', :group => "development"
gem 'rake', :group => :test
group :development do
gem "capistrano"
gem "magic_encoding"
gem "annotate"
end
group :test, :development do
gem "rspec"
gem "rspec-rails"
gem "simplecov"
gem "capybara"
end
then I try to comment this row:
gem 'mysql2'
but I still got the error.
so I do not know why this error occurs
try it
sudo apt-get install mysql-client libmysqlclient-dev
#Ricardo Masao Shigeoka for the mac ,try first
brew install mysql, then
Put in your Gemfile gem 'mysql2', '0.3.18'
run bundle command in terminal.
This setup worked for me, I have El Captain OS, rails 4.2.6, hope this helps
Try this one
gem 'mysql2', '~> 0.4.10'

ZenTest 4.9.3 shows as invalid gemspec

I keep getting this error when trying to run ZenTest
Invalid gemspec in [/usr/local/rvm/gems/ruby-1.9.3-p194/specifications/ZenTest-4.9.3.gemspec]: Illformed requirement ["< 2.1, >= 1.8"].
I have tried removing the ZenTest 4.9.3 and gem instal ZenTest 4.8.3 but that version cannot be found in any repositories so it automatically installs ZenTest 4.9.3 which keeps having an error and hence I cant run spork or autotest. Is there any way around this? Thanks!
Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'spork'
gem 'rspec-core'
gem 'autotest', '4.4.6'
gem 'autotest-rails', '4.1.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'webrat'
gem 'capybara'
gem 'Zentest', '4.8.3'
end
group :production do
gem 'pg'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
I had the same problem. After digging, I found the solution. The problem is most likely to be with the version of RubyGems installed in your system. (It would be <1.8.25)
Till that version, RubyGems didn't roundtrip gemspecs properly and thus couldn't parse "< 2.1, >= 1.8" correctly.
So, go through these steps:
gem uninstall ZenTest
gem update --system
gem install ZenTest
The problem should get solved and you should no longer receive the warnings.

Error while running bundle install in CentOS

I am getting the following error while running bundle install. I am getting this error while installing i18n gem. I am getting this error in Cent OS machine only.I didn't get this error in Windows machine.
[root#centos5_9 IDEA]# bundle install
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
System.java:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException
from DefaultResolver.java:111:in `makeTime'
from DefaultResolver.java:277:in `create'
from DefaultResolver.java:317:in `handleScalar'
from DefaultResolver.java:435:in `orgHandler'
from DefaultResolver.java:455:in `node_import'
from org/yecht/ruby/DefaultResolver$s_method_1_0$RUBYINVOKER$node_import.gen:65535:in `call'
from CachingCallSite.java:146:in `call'
from RubyLoadHandler.java:40:in `handle'
from Parser.java:300:in `addNode'
from DefaultYAMLParser.java:676:in `yyparse'
from Parser.java:290:in `yechtparse'
from Parser.java:284:in `parse'
My gem file contains following code.
source 'http://rubygems.org'
gem 'rails', '3.2.13'
gem "xml-simple", "=1.0.12"
gem "fastercsv", "=1.5.3"
gem "hpricot", "=0.8.2"
gem "newrelic_rpm", "=3.1.1"
gem "mime-types", "=1.16"
gem "writeexcel", "=0.6.4"
gem "i18n"
#gem "warbler","=1.3.0"
gem "rmagick4j","=0.3.7"
gem "starling","=0.10.1"
gem "jruby-memcache-client","=1.7.0"
gem "tzinfo","=0.3.29"
gem "jruby-jars","=1.5.6"
gem "jruby-rack","=1.0.5"
gem "activerecord-jdbc-adapter","=1.2.9"
gem "activeresource","=3.2.13"
gem "activesupport","=3.2.13"
gem "bouncy-castle-java","=1.5.0147"
gem "bundler","=1.3.5"
gem "columnize","=0.3.2"
gem "eventmachine","=0.12.10"
gem "jdbc-mysql"
gem "jruby-openssl","=0.8.8"
gem "jruby-prof","=0.1.0"
gem "memcache-client","=1.8.5"
gem "rack","=1.4.5"
gem "rake","=0.8.7"
gem "rspec","=1.3.0"
# gem "ruby-debug-base","=0.10.3.2"
gem "rubyzip","=0.9.4"
gem "sources","=0.0.1"
gem "mogli","=0.0.25"
gem "facebooker2","=0.0.8"
gem "json","=1.5.1"
gem "multi_json","=1.0.3"
gem "net-ldap", "=0.2.2"
gem "multi_xml","=0.4.1"
gem "httparty","=0.8.1"
gem 'exception_notification', :require => 'exception_notifier'
gem 'safe_attributes'
gem 'will_paginate'
gem 'delayed_job_active_record'
gem "daemons"
gem 'jruby-rack-worker', :platform => :jruby, :require => nil
#gem "ffi", "~> 1.9.0"
#gem 'spoon'
gem "resque"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyrhino'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
platforms :jruby do
# gem "ruby-debug", "= 0.10.3"
# This is needed by now to let tests work on JRuby
# TODO: When the JRuby guys merge jruby-openssl in
# jruby this will be removed
#gem "jruby-openssl"
group :db do
gem "activerecord-jdbcmysql-adapter", "=1.2.9"
end
end
I am using rails 3.2.13.Please help us on this.
Thanks,
Initially reinstall the bundler at root or set up the ruby and rails environment:-
$ gem install bundler / brew gem install bundler
$ rvm use <ruby/jruby version>#<rails_version> if you are using rvm
Now go in your application directory and then run
$ bundle install
$ bundle update ( to get the latest version gem )
and you can try https://rubygems.org # some time it will work

Gemfile Syntax Error

I get the following error: Gemfile Syntax Error.
Here is my code:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
gem 'devise'
# Bundle bootstrap gems
group :development do
gem 'thin'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
You're missing an end for the do in group :development. Add an end statement on the line after gem 'sqlite3'.
You can run ruby -c Gemfile to check the syntax (it's regular Ruby code), and it'll give you an idea of where the error lies.
It looks like you are missing a end after the development group.
I encountered the error several times, but I didn't touch the file generated by rails and ruby -c Gemfile says syntax is Ok. In my case, if rails command can not be found, Gemfile syntax error might be reported.
I use brew+rbenv+ruby 2.0+rails 4 and I use the following commands to get things back to normal.
# new commands in brew-installed ruby might not be linked automatically
brew unlink ruby && brew link ruby
# fix "gem" itself
sudo gem update --system
# after installing executable with rbenv, you need rehash
rbenv rehash

Could not find bootstrap-sass-2.2.2.0

I'm trying to get Rails up and running. I'm able to run bundle install successfully, but when I attempt to start the server using rails s I get the following message:
Could not find bootstrap-sass-2.2.2.0
Run `bundle install` to install missing gems.
Here's my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'rails_admin'
gem 'devise'
gem 'cancan'
gem 'simple_form'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
# The following three gems are used for Bootstrap
# See: https://github.com/seyhunak/twitter-bootstrap-rails
#NOTE: For therubyracer, run "gem install libv8" and "gem install therubyracer -v '0.11.0'"
end
gem 'therubyracer', '0.11.0beta8'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem "less-rails"
gem 'bootstrap-sass', '~> 2.2.2.0'
gem 'jquery-rails'
I made a mistake by adding a gem into the gem file with a capital letter before running bundle install. Look over that you dont have any capital letters with the gems you are adding.
Should look like this:
gem 'bootstrap-sass'
Should not look like this:
gem 'Bootstrap-sass'

Resources