从同学那里拿来一个rails项目工程的源码,发现Gemfile中rails版本是3.2.11,和我安装的不一样,于是运行bundle update rails ,报错如下:
Installing pg 0.14.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/zkp/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20150912-4116-1fwu6vx.rb 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.
在网上查找解决办法,http://blog.sina.com.cn/s/blog_671ada9701011ksr.html
需要执行sudo apt-get install libpq-dev
执行后问题解决,安装完成。