【问题标题】:An error occurred while installing pg (1.1.4), and Bundler cannot continue安装 pg (1.1.4) 时出错,Bundler 无法继续
【发布时间】:2019-09-13 01:08:25
【问题描述】:

试图执行bundle

$ gem install pg -v '1.1.14' --source 'https://rubygems.org/'

Gem 文件将继续安装在 /home/saishbhende24/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pg-1.1.4 以供检查。 结果记录到 /home/saishbhende24/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/pg-1.1.4/gem_make.out 安装 pg (1.1.4) 时出错,Bundler 无法继续。 在捆绑之前确保gem install pg -v '1.1.4' --source 'https://rubygems.org/'succeeds。 在 Gemfile 中: 皮克 saishbhende24@DESKTOP-ELUO53H:/mnt/c/saishrails/r5.1$ gem install pg -v '1.1.14' --source 'https://rubygems.org/' 错误:在任何存储库中都找不到有效的 gem 'pg' (= 1.1.14) 错误:可能的替代方案:pg

输出为rails server

【问题讨论】:

  • 你使用的是什么操作系统?
  • @Coco Windows 10
  • 检查你是否安装了 postgres 客户端,我从不在 Windows 上开发,但这是其他平台上需要的,因为pg 使用 postgres-client 连接到 postgres-server。希望对您有所帮助。
  • @Coco 我该如何检查

标签: ruby-on-rails debian ruby-on-rails-5


【解决方案1】:

确保您已经为 Windows 安装了 postgres。有official installers here。然后再试一次。

然后,如果您仍然遇到问题,请先尝试手动安装 pg gem:

bundle install pg

如果您仍然遇到问题,您还可以查看在 docker 上运行 rails、postgres 和所有其他依赖项,例如其余的 gems、redis 等。在 Windows 上运行 ruby​​ 是出了名的可怕体验。有很多事情不像在 Linux 上那么容易。如果您仍然遇到问题,Docker 可以为您解决很多这些问题。

【讨论】:

  • HTTP 解析错误,格式错误的请求():#<:httpparsererror: invalid http localhost:3000> 时收到这个
【解决方案2】:
gem sources --add https://rubygems.org/ 

修复了这个问题。

【讨论】:

    猜你喜欢
    • 2014-01-12
    • 2018-04-05
    • 2020-05-07
    • 2021-05-13
    • 2017-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多