【问题标题】:An error occurred while installing pg (1.0.0), and Bundler cannot continue安装 pg (1.0.0) 时出错,Bundler 无法继续
【发布时间】:2019-03-26 20:51:35
【问题描述】:

我正在尝试使用 heroku 部署 Zipsell。但是,当我运行 heroku 和 ruby​​ 设置并尝试通过以下方式部署时:

git clone https://github.com/yongfook/zipsell
cd zipsell
./bin/setup

我收到错误消息:

安装 pg (1.0.0) 时出错,Bundler 无法继续。

在捆绑之前确保gem install pg -v '1.0.0' --source 'https://rubygems.org/' 成功。

In Gemfile:
  pg

我现在已经多次运行设置过程并重新安装了所有但仍然无法部署。知道出了什么问题吗?

【问题讨论】:

  • 您需要安装pg 作为您的数据库。你在用sqlite吗?你能显示你的Gemfile吗?
  • 当我运行捆绑检查时,我得到以下信息:缺少以下宝石 * pg (1.0.0) * puma (3.12.0) * sprockets (3.7.2) * sprockets-rails (3.2 .1) * rails (5.2.1) ...当我运行 bundle install 时,我也会收到错误消息。运行 gem install pg -v'1.0.0' 我收到:安装 pg 时出错:错误:无法构建 gem 原生扩展。
  • 再次分享您的Gemfile,您可能需要安装这些 gem。
  • 嗨史蒂文,感谢您的回复。 Abosulte bginner 在这里显示竞争 gemfile 的命令是什么?提前致谢!
  • Gemfile 是您项目中的一个文件。是调用项目所有依赖项的地方。

标签: heroku build rubygems pg gemfile


【解决方案1】:

从您发布的 repo 看来,错误消息非常清楚。从您共享的存储库的 Gemfile 中,您似乎没有安装 pg,即 postgresql(您需要删除 sqlite

问题是缺少一些您没有安装的依赖项,这就是引发错误的原因。有gems 的概念,它是打包代码。 https://rubygems.org/ 通过以下网站,您可以找到一些您缺少的宝石。还有必须兼容的版本。

您要做的是搜索错误消息中显示的缺少的gems。如果您在 Gemfile 中使用 gem,请检查正确的版本,但版本冲突。

https://github.com/yongfook/zipsell/blob/master/Gemfile

bundle update

安装缺失的 gems

gem install pg 等等。或者直接在 Gemfile 中进行。

【讨论】:

  • 嘿,谢谢!这为我指明了正确的方向。我发现另一篇文章说明了以下内容,它解决了我在 MAC 上的问题:如果您不确定 pg_config 在哪里,并且假设您在 Linux 或 Mac 上,则可以运行以下命令:which pg_config this will return ==> /usr /pgsql-9.1/bin/pg_config 现在将此路径用作捆绑配置 build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config 现在完成捆绑安装
  • 嘿史蒂夫,非常感谢。可能会带着更多的问题回来:D
  • @StelzenPieper 即使我很欣赏你的意图,也要避免“谢谢”cmets。 meta.stackexchange.com/questions/126180/… 这将帮助您在您的旅程中浏览 stackoverflow 社区指南。
猜你喜欢
  • 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
相关资源
最近更新 更多