ruby-on-rails gem pg未安装

xzlaal3s  于 2022-12-20  发布在  Ruby
关注(0)|答案(2)|浏览(190)

所以我不得不在我的电脑崩溃后重新初始化一个项目,我正在ruby上重新安装我所有的gem,不幸的是当我运行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

如果有人能给予我一个正确的方向,这将是非常感谢。

kiz8lqtg

kiz8lqtg1#

试试这个

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安装页
推荐使用ruby 2.4.2
干杯!

kcwpcxri

kcwpcxri2#

sudo apt-get install postgresql
sudo apt-get install libpq-dev

相关问题