How do I install sqlite3 for Ruby on Windows?

2019-01-04 09:13发布

Being really new to Ruby/Rails, and after attempting to resolve the issue myself this weekend I'm making an attempt to seek advice here.

I have a complete Ruby/Apache/Passenger setup done on FreeBSD, and I'm trying to accomplish the task of using Windows as a Ruby development environment.

So far:

  • Ruby is installed, v2.0.0p0 (2013-02-24) [x64-ming32]
  • Rails is installed, v.3.2.12
  • I have the Ruby dev kit installed and registered.
  • I have the sqlite3 dll/exe copied to the Ruby "bin" folder (which is also in my path using the "Start Command Prompt with Ruby" console.)
  • I can start a rails server successfully, and continuing with the http://guides.rubyonrails.org/getting_started.html tutorial to 3.3.
  • ">rake db:create" tells me:

    Please install the sqlite3 adapter: gem install activerecord-sqlite3-adapter ( sqlite3 is not part of the bundle. Add it to Gemfile.)

which I have no "understanding" of. Trying to install activerecord-sqlite3-adapter gives me a "Could not find a valid gem..."

  • ">gem install sqlite3" returns:

    Building native extensions. This could take a while... ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension.

    D:/Development/Ruby200-x64/bin/ruby.exe extconf.rb checking for sqlite3.h... *** extconf.rb failed ***

Right now I'm stuck at the point where I don't even know what state my Ruby on Windows installation is in. I'm trying to follow the main Rails tutorial and it doesn't specify any of these issues (probably because Ruby on Windows seems to be a natural pain for a lot of people.)

What am I missing?!? I'm just trying to install sqlite3 for Ruby on Windows, seems simple right?

If I do ">rais db" the SQLite shell is presented:

SQLite version 3.7.15.2 2013-01-09 11:53:05

Similar questions with steps that do not resolve my issue: Installing SQLite 3.6 On Windows 7

7条回答
我只想做你的唯一
2楼-- · 2019-01-04 09:54

I figured I'd put in an answer -- from the comments, for posterity's sake. The issue seemed to be that I grabbed a new version of Ruby/Rails (for Windows) that was not compatible "yet" with SQLite3.

I downgraded to 1.9.x and was able to things running.

查看更多
登录 后发表回答