gpt4 book ai didi

ruby-on-rails - rails 中的事件记录 postgresql 适配器错误

转载 作者:行者123 更新时间:2023-12-04 06:15:47 25 4
gpt4 key购买 nike

这是我的问题。我正在尝试创建一个博客。我运行'rails new blog'。在我尝试 '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

需要配置选项。

我的 gem 文件:
  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 key :

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

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

关于ruby-on-rails - rails 中的事件记录 postgresql 适配器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15338748/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com