This is probably a newbie setup problem. But here goes...
Machine setup
I have a Windows 7 64 bit machine running rails 4.0.0 and ruby 2.0.0 I have the following in my Path
C:\Ruby200-x64\bin;C:\RubyDevKit\bin;C:\RubyDevKit\mingw\bin;
Project setup
I am working from a cloned git project from a colleague's working repository.
When I run my initial
rake db:migrate
I get the following error
rake aborted!
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 's
qlite3'` to your Gemfile.
C:/Working/mynewproject/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
My Gemfile does contain gem 'sqlite3' as follows
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
The complete Gemfile is
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
gem 'rails_12factor', group: :production
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Twitter Bootstrap for styling
gem 'bootstrap-sass'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.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'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'protected_attributes' # should probably use strong parameters!
When I run bundle install
I get the following list - note the absence of sqlite3
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.13)
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.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
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 sass (3.2.10)
Using bootstrap-sass (2.3.2.2)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
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.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using protected_attributes (1.0.3)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rails_serve_static_assets (0.0.1)
Using rails_stdout_logging (0.0.2)
Using rails_12factor (0.0.2)
Using rdoc (3.12.2)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
When I do bundle show 'sqlite3'
I get
Could not find gem 'sqlite3'.
Did you mean sqlite3?
When I do gem install 'sqlite3'
I get
Successfully installed sqlite3-1.3.8-x64-mingw32
Parsing documentation for sqlite3-1.3.8-x64-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/sqlite3/2.0/sqlite3_native.so, skipping
1 gem installed
Having searched about to see about that "unable to convert" error, I found that I could install without documentation. So, if I do
gem install 'sqlite3' --no-doc
I get
Successfully installed sqlite3-1.3.8-x64-mingw32
1 gem installed
and then when I do
rake db:migrate
I still get
rake aborted!
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 's
qlite3'` to your Gemfile.
C:/Working/mynewproject/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
So, what have I missed?
Thanks
Update after doing things suggested in the comments:
As a result of Doon's comment I have put the gemfile contents in the description of the problem above
In response to techvineet's comment I have ran bundle install
several times with consistent outputs.
As a result of zrl3dx's comment I have now ran bundle exec bundle
and get the same output, i.e.
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.13)
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.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
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 sass (3.2.10)
Using bootstrap-sass (2.3.2.2)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
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.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using protected_attributes (1.0.3)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rails_serve_static_assets (0.0.1)
Using rails_stdout_logging (0.0.2)
Using rails_12factor (0.0.2)
Using rdoc (3.12.2)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
As a result of Sachin Singh's comment I deleted Gemfile.lock and ran bundle install
. The results were pretty much the same:
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.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.13)
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.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
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 sass (3.2.10)
Using bootstrap-sass (2.3.2.2)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
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.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using protected_attributes (1.0.3)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rails_serve_static_assets (0.0.1)
Using rails_stdout_logging (0.0.2)
Using rails_12factor (0.0.2)
Using rdoc (3.12.2)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
so still no mention of sqlite3 and rake db:migrate
still results in
rake aborted!
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 's
qlite3'` to your Gemfile.
C:/Working/its-a-disaster/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
In response to Sachin Singh's question what is the output of ruby -v command
?
It says:
ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
and rails --version says
Rails 4.0.0
Prusswan asked are there other ruby installations on the same machine?
There were three - 1.9.2, 1.9.3 and 2.0.0 The latter is the one in the path. The other two I have since removed.
Rails comes with built-in support for SQLite, which is a lightweight serverless database application. While a busy production environment may overload SQLite, it works well for development and testing. Rails defaults to using a SQLite database when creating a new project, but you can always change it later.
There is a known problem with Bundler and 64bits Ruby, which is not detecting x64-mingw32
gem platforms into the bundle, thus making it fail.
I believe this has been fixed in the 1.4.0 pre-release versions, and you can try that by doing:
gem update bundler --pre
bundle install
There are other issues you might encounter with the 64bits version. The following is my personal recommendation about it:
Unless you're really forced to work or create applications that uses more than 2GB of RAM (most likely not a Rails application), I recommend you use the 32bits version of Ruby (and the respective DevKit)
While you have a 64bits version of Windows, the system is quite capable of running 32bits applications without issues. There is no performance degradation that can be noticeable when developing Web applications with Rails.
While Ruby 2.0.0 has been marked as stable and production ready, not all the gems and related tools has been updated to work properly with it. There are still some rough edges that needs to be ironed out, as you can see on the case of Bundler and 64bits Ruby. As most of the open-source software, this is a community effort and help might be required.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With