未加载指定的sqlite3 gem [英] Specified sqlite3 gem not loaded

查看:141
本文介绍了未加载指定的sqlite3 gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我是Ruby on Rails的新手,但我已经开发了短时间的应用程序.我似乎遇到的问题是当我创建一个新的Rails应用程序(在本地/使用c9)时,我似乎在启动apache服务器时收到此错误

"Specified 'sqlite3' for database adapter, but the gem is not loaded. 
Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the 
minimum required by ActiveRecord)"

在我的宝石文件中,我可以看到sqlite3宝石存在.

我尝试卸载和重新安装sqlite3 gem,同时尝试了1.3.13版和1.4.0版,但没有成功.

我还从git hub到我的本地"和c9开发环境中,将git较早完成的应用程序之一"git clone"到了我的机器上,并且可以很好地工作,直到我捆绑更新为止,然后得到相同的错误消息!

有人可以给我一些建议吗?我知道这个问题是几年前提出的,但我想知道最近是否有人遇到过这个问题,以及是否/如何解决了这个问题?

非常感谢

解决方案

这很奇怪,但是两周前我也遇到了同样的问题,当我启动rails new project时,它把gem 'sqlite3'没有任何版本号,和我得到同样的错误.所以我在brew上玩了很多游戏,所以我认为这是一个问题,原因是与SQLite一起玩,所以我才知道Sqlite3 gem可能有问题.我注意到它正在加载1.4版本.

我按照更改进行了工作,并且奏效了.

gem 'sqlite3', '~> 1.3.11'

以防万一有人搜索了这个问题的答案,因为它解决了提问者的问题.

Although I am relatively new to Ruby on Rails, I have been developing apps for a short while now. The problem I seem to have is when I create a new rails app (locally / using c9) I seem to be getting this error when I start up the apache server

"Specified 'sqlite3' for database adapter, but the gem is not loaded. 
Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the 
minimum required by ActiveRecord)"

In My Gem file I can see that the sqlite3 gem is present.

I have tried uninstalling and reinstalling the sqlite3 gem trying both versions 1.3.13 as well as 1.4.0 but with no success.

I have also 'git cloned' one of my older completed apps from git hub on to my 'local' and c9 development environments and will work perfectly until I bundle update, Then I get the same error message!

Can anyone give me some advise? I am aware that this problem was brought up a few years back but was wondering if anyone has encountered this recently and if/how they resolved this?

Many Thanks

解决方案

It is very strange but two weeks ago I also got the same issue, and when I initiate my rails new project it put gem 'sqlite3' without any version number, and I get the same error. So I played a lot on brew so I thought it is an issue due to that playing with SQLite, somehow I came to know that maybe my Sqlite3 gem has an issue. And I noticed it is loading 1.4 version of it.

I did following change and it worked.

gem 'sqlite3', '~> 1.3.11'

Just in case if someone searching answer of this question, as it resolved issue of question asker.

这篇关于未加载指定的sqlite3 gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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