gpt4 book ai didi

ruby-on-rails - 服务器安装出现错误:无法在任何来源中找到 pg-0.17.1 (Bundler::GemNotFound)

转载 作者:数据小太阳 更新时间:2023-10-29 08:47:29 26 4
gpt4 key购买 nike

尝试使用 nginx 和 Passenger 在 CentOS 6.5 上运行 Ruby 2.0.0。到目前为止,由于错误而没有运气:http://prntscr.com/3egoca

这是我安装用于 Ruby 的 PostgreSQL 服务器的过程:

sudo vi /etc/yum.repos.d/CentOS-Base.repo

# In both [base] and [updates] sections I added the following line to the file above:
# exclude=postgresql*

sudo rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
sudo yum install postgresql93 postgresql93-devel postgresql93-server postgresql93-libs postgresql93-contrib
sudo /etc/init.d/postgresql-9.3 initdb
sudo service postgresql-9.3 start
sudo chkconfig --levels 235 postgresql-9.3 on

# At the bottom of this file I changed authentication method to md5:
sudo vi /var/lib/pgsql/9.3/data/pg_hba.conf
sudo service postgresql-9.3 restart

到目前为止一切顺利,PostgreSQL 在测试时按预期工作,但这是它失败的地方:

bundle install

这给了我错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/home/deploy/.rvm/rubies/ruby-2.0.0-p451/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

所以我听从了那个建议并尝试像这样单独安装 PG gem:

gem install pg -- --with-pg-config=/usr/pgsql-9.3/bin/pg_config

当我尝试这样做时,我得到了这个输出:

Building native extensions with: '--with-pg-config=/usr/pgsql-9.3/bin/pg_config'
This could take a while...
Successfully installed pg-0.17.1
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.17.1
unable to convert "\xF0" from ASCII-8BIT to UTF-8 for ../../extensions/x86_64-linux/2.0.0/pg-0.17.1/pg_ext.so, skipping
unable to convert "\xF0" from ASCII-8BIT to UTF-8 for lib/pg_ext.so, skipping
1 gem installed

尽管说它已成功安装,但我仍然收到 Passenger 错误,我发布了截图,但我仍然无法成功运行 bundle install

顺便说一句,我作为用户“部署”使用 SSH,这也是 nginx 在 nginx.conf 文件中设置为用户的原因。

最佳答案

尝试:

export PATH=/usr/pgsql-9.3/bin:$PATH
bundle install

关于ruby-on-rails - 服务器安装出现错误:无法在任何来源中找到 pg-0.17.1 (Bundler::GemNotFound),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23355477/

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