Cannot start a new rails server - sqlite.3h is missing
I am trying to run a rails server on ruby on my Windows 7 operating system. I made a new rails application but when I try to run the server I get the following error:
D:\projects\RubyOnRails>rails server => Booting WEBrick => Rails 3.2.13 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:214:in `block in replace_gem': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)
Trying to install activerecord-sqlite3-adapter:
D:\projects\RubyOnRails>gem install activerecord-sqlite3-adapter ERROR: Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any repository ERROR: Possible alternatives: activerecord-jdbcsqlite3-adapter, activerecord-sqlserver-adapter, activerecord-bq-adapter, activerecord-simpledb-adapter, activerecord-mysql2-adapter
After I try to install the sqlite3 gem I get the following error (I also had to install the DevKit to be able to proceed up to this step):
D:\projects\RubyOnRails>gem install sqlite3 Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension. D:/Ruby200-x64/bin/ruby.exe extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first. *** 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.
In the System32 folder I have the sqlite3.dll, sqlite3.exe and sqlite export definition file.
Also, the sqlite3 seems to be working fine:
D:\projects\RubyOnRails>sqlite3 SQLite version 220.127.116.11 2013-04-12 11:52:43 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite>
Also, my bundle is up to date:
D:\projects\RubyOnRails>bundle check The Gemfile's dependencies are satisfied
However in my gemfile there is no information about the version of the sqlite3 gem and when I put one the server fails to start:
source 'https://rubygems.org' gem 'rails', '3.2.13' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3'
You need to install sqlite3-ruby gem instead of sqlite3 only
Go to http://www.sqlite.org, and download sqlitedll under "Precompiled Binaries For Windows". Extract the file and put two files sqlite3.dll and sqlite3.def in the ruby bin's directory, i.e., C:\ruby\bin. Run "gem install sqlite3-ruby" to install sqlite3-ruby gem. (Try "gem install --version 1.2.3 sqlite3-ruby" if the latest version is not working)