如何在 Windows 8 上安装 sqlite 或 postgresql 以进行 ruby​​ on rails 设置? [英] How to install sqlite or postgresql on windows 8 for a ruby on rails setup?

查看:27
本文介绍了如何在 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.

  1. 安装

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 设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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