服务器安装遇到错误:无法在任何源中找到pg-0.17.1(Bundler :: GemNotFound)

时间:2014-04-29 04:27:24

标签: ruby-on-rails ruby postgresql nginx

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

这是我用于安装PostgreSQL服务器以与Ruby一起使用的过程:

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文件中的用户。

1 个答案:

答案 0 :(得分:3)

尝试:

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