如何在 Windows 8 上安装 sqlite 或 postgresql 以进行 ruby​​ on rails 设置?

编程入门 行业动态 更新时间:2024-10-28 20:24:54
本文介绍了如何在 Windows 8 上安装 sqlite 或 postgresql 以进行 ruby​​ on rails 设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在尝试安装一个数据库作为我的 ruby​​ on rails 设置的一部分.我正在运行 64 位 Windows 8,这是一台基于 x64 的机器.我的 ruby​​ 版本是 2.1.3p242,rails 版本是 4.0.0,sqlite3 版本是 3.8.6,postgresql 版本是 9.3我首先尝试按照此 SO 中给出的步骤安装 sqlite3回答但我收到此错误

I've been trying to install a database as part of my ruby on rails setup. I'm running a 64 bit windows 8, a x64 based machine. My ruby version is 2.1.3p242, rails version is 4.0.0, sqlite3 version is 3.8.6 and postgresql version is 9.3 I first tried to install sqlite3 by following the steps given in this SO answer but I get this error

`require': Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid.

我的 database.yml 将sqlite3"作为所有三种环境的适配器键的值.接下来我尝试安装正确安装的 postgresql.我启动了 pgadmin3 GUI 并启动了数据库服务器.但是当我启动 rails 服务器时.我收到以下错误

My database.yml has 'sqlite3' as the value for the adapter key for all three environments. Next I try to installed postgresql which was installed properly. I fired up the pgadmin3 GUI and started the database server. But when I start the rails server. I get the following error

C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `re quire': cannot load such file -- 2.1/pg_ext (LoadError)

谢谢.

推荐答案

您需要使用pg的预发布版.

You need to use the pre release of pg.

  • 安装 gem install pg -v 0.18.0.pre20141117110243 --pre

  • 添加到您的 Gem 文件

  • Add to your Gem file

    gem 'pg', '~> 0.18.0.pre20141117110243'

  • 使用捆绑包更新

  • Update with Bundle

    bundle update

  • 更多推荐

    如何在 Windows 8 上安装 sqlite 或 postgresql 以进行 ruby​​ on rails 设置?

    本文发布于:2023-10-20 01:00:36,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1509356.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:如何在   Windows   sqlite   rails   ruby

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!