rails sqlite 适配器错误 [英] rails sqlite adapter error

查看:52
本文介绍了rails sqlite 适配器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照 rails 教程中的说明进行操作,并且尝试使用脚手架命令时卡住了.

I'm following the instructions in rails tutorial and got stuck when trying to use the scaffold command.

运行时:

rails generate scaffold User name:string email:string  

我收到错误:

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (can't activate sqlite3 (~> 1.3.4), already activated sqlite3-1.3.3-x86-mingw32. Make sure all dependencies are added to Gemfile.) (RuntimeError)

运行:

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-nulldb-adapter, activerecord-spatialite-adapter, activerecord-simpledb-adapter

我的 Gemfile 看起来像这样:

My Gemfile looks like this:

source 'http://rubygems.org'
gem 'rails', '3.1.0'  
gem 'sqlite3', '1.3.3'  
...

我在 Windows 7 x64 操作系统上运行.

I'm running on Windows 7 x64 OS.

有什么想法吗?

推荐答案

好的,我发现问题了.我注意到我的 Rails 安装有 SQLite 1.3.3 和 1.3.4 我改变了我的 Gemfile:

Ok I found the problem. I noticed that my Rails installation has both SQLite 1.3.3 and 1.3.4 I changed my Gemfile from:

gem 'sqlite3', '1.3.3'

到:

gem 'sqlite3', '1.3.4'

这就解决了问题.感谢 @holger-just 将我指向 他们的答案.

That solved the problem. Thanks @holger-just for pointing me to the relevant line in the error message in their answer.

这篇关于rails sqlite 适配器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆