所以我不得不在我的电脑崩溃之后重新初始化一个项目,并且正在重新安装我在宝石上的所有宝石。不幸的是,当我运行bundle install时,我收到以下错误。
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /usr/lib/ruby/gems/2.3.0/gems/pg-0.21.0/ext
/usr/bin/ruby2.3 -r ./siteconf20170925-462-dsymf.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /usr/lib/ruby/gems/2.3.0/gems/pg-0.21.0
for inspection.
Results logged to /usr/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-
0.21.0/gem_make.out
如果有人能给我一个正确方向的观点,我们将不胜感激。
答案 0 :(得分:3)
试试这个
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.5 libpq-dev
gem install pg
推荐使用ruby 2.4.2
干杯!