简体   繁体   English

Rails 看不到我的 sqlite3

[英]Rails doesn't see my sqlite3

I've recently changed computers (Mac with OS 10.6.7) and I'm trying to launch my RoR application.我最近更换了计算机(装有 OS 10.6.7 的 Mac),我正在尝试启动我的 RoR 应用程序。 It didn't work because apparently sqlite3 was missing.它不起作用,因为显然 sqlite3 丢失了。 I've tried updating it using我尝试使用更新它

gem install sqlite3

but it doesn't work and the following error is issued:但它不起作用,并发出以下错误:

Error installing sqlite3:
ERROR: Failed to build gem native extension.

But the thing is, I can use the sqlite3 command on the terminal, which launches perfectly, announcing a 3.6.23.1 version.但问题是,我可以在终端上使用 sqlite3 命令,它可以完美启动,宣布 3.6.23.1 版本。 Why can't rails see it?为什么rails看不到? It is indeed not installed as a gem, is that why?它确实没有作为 gem 安装,这是为什么呢? Suggestions on how to solve this issue?关于如何解决这个问题的建议? Thanks.谢谢。

PS: I've tried doing PS:我试过做

port install sqlite3

but it doesn't work either because:但它也不起作用,因为:

Error: Cannot install sqlite3 for the arch(s) 'x86_64' because
Error: its dependency readline is only installed for the arch 'i386'
Error: and the configured universal_archs 'i386 ppc' are not sufficient.
Error: Unable to execute port: architecture mismatch

Was this system upgraded from 10.5 to 10.6?这个系统是从 10.5 升级到 10.6 的吗? That error message that you are getting when trying to run port install sqlite3 sounds like a number of errors that I received when I had done an upgrade and not a clean install.您在尝试运行port install sqlite3时收到的错误消息听起来像是我在完成升级而不是全新安装时收到的一些错误。

My guess: you need to build a new version of readline (64-bit, your current one appears to be 32-bit) and then build a new version of sqlite3.我的猜测:您需要构建一个新版本的 readline(64 位,您当前的似乎是 32 位),然后构建一个新版本的 sqlite3。 I have no idea how many other dependencies you have on readline (probably quite a few) so this could be a little bit of a lengthy process.我不知道您在 readline 上有多少其他依赖项(可能很多),所以这可能是一个漫长的过程。

This really isn't my forte, but I went through a bunch of similar issues during my upgrade, as I said, and this is how I resolved most of them.这真的不是我的强项,但正如我所说,我在升级过程中遇到了很多类似的问题,这就是我解决大部分问题的方法。

Having the sqlite gem and sqlite is not the same thing.拥有 sqlite gem 和 sqlite 不是一回事。 You've got the database, but you need the gem installed to allow ruby to access your sqlite db.您已经拥有数据库,但您需要安装 gem 以允许 ruby 访问您的 sqlite 数据库。

The gems you should have are你应该拥有的宝石是

sqlite3 (1.3.3)
sqlite3-ruby (1.3.3)

Try installing gem sqlite3-ruby it should auto grab the right dependency.尝试安装 gem sqlite3-ruby它应该自动获取正确的依赖项。 I've also seen that error if permissions are not correct, you may need to run the command as sudo .如果权限不正确,我也看到了该错误,您可能需要将命令作为sudo运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM