gpt4 book ai didi

ruby-on-rails - rails 问题 - "Could not find gem ' pg”

转载 作者:行者123 更新时间:2023-11-29 11:43:59 24 4
gpt4 key购买 nike

大家好。我对 Rails 有一个小问题。今天我安装了 Rails 3 并决定创建一个新项目。

rails new blablabla --database=postgresql

我编辑了 database.yml 并将我的数据库、postgres 的登录名和密码粘贴到其中。我的 postgresql 在端口 5433 上工作(而不是 5432)database.yml 示例:

development:
adapter: postgresql
database: devdb
encoding: utf8
username: postgres
password: mypassword
host: localhost
port: 5433

我只想启动服务器,或添加 Controller ,但 rails 说:

Could not find gem 'pg (>= 0)' in any of the gem sources listed in your Gemfile

但我有'pg'。我认为端口有问题,但我不知道如何解决问题。

抱歉英语不好,感谢您的回答。

最佳答案

从错误消息中可以看出,您正在使用 Bundler 来管理项目的 gem。您是否尝试过运行 bundle install 来更新 Gemfile 中的所有源代码?这是一个例子:

> bundle install
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
[...]
Using zendesk_remote_auth (0.9.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

关于ruby-on-rails - rails 问题 - "Could not find gem ' pg”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5636525/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com