加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – rails中的活动记录postgresql适配器错误

发布时间:2020-12-17 03:22:49 所属栏目:百科 来源:网络整理
导读:这是我的问题.我正在尝试创建一个博客.我运行’rails new blog’. Everythign没问题,直到我尝试’rake db:create’.它返回一个错误: rake aborted!Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part
这是我的问题.我正在尝试创建一个博客.我运行’rails new blog’. Everythign没问题,直到我尝试’rake db:create’.它返回一个错误:

rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)

当我尝试安装pg适配器时,我得到了这个:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing activerecord-postgresql-adapter:
    ERROR: Failed to build gem native extension.

F:/Ruby200-x64/bin/ruby.exe 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

需要配置选项.

我的gemfile:

source 'https://rubygems.org'

gem 'rails','3.2.12'

# Bundle edge Rails instead:
# gem 'rails',:git => 'git://github.com/rails/rails.git'

gem "pg"

# Gems used only for assets and not required
# in production environments by default.
 group :assets do
  gem 'sass-rails','~> 3.2.3'
  gem 'coffee-rails','~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer',:platforms => :ruby

  gem 'uglifier','>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby','~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

知道吗?

解决方法

你安装了Postgres吗?如果是这样,请确保pg_config.exe位于PATH中.或者使用–with-pg-config或-with-pg-dir键:

gem install pg --with-pg-config=<path>

详见https://github.com/ged/ruby-pg/blob/master/README-Windows.rdoc

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读