簡體   English   中英

嘗試運行服務器時,Ruby on Rails postgres適配器錯誤

[英]Ruby on Rails postgres adapter error when trying to run the server

我已經安裝了我在如何處理Ruby on Rails中列出的所有寶石錯誤:“請安裝postgresql適配器:`gem install activerecord-postgresql-adapter'” - 它們都不起作用。 如果我在databases.yml文件中有postgres或postgresql並不重要。

我不知道我做錯了什么(我也安裝了錯誤中提到的驅動程序。我不斷收到錯誤。

/var/lib/gems/1.8/gems/bundler-1.1.5/lib/bundler/rubygems_integration.rb:147:in `gem': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) 

我正在嘗試運行“rails server webrick -p 80 -e production”

production:
  adapter: postgresql
  encoding: unicode
  database: imentor
  pool: 5
  username: postgres
  password: 
  host: localhost
  port: 5432

我的問題是我實際上並不知道在哪里編輯gemfile((最初查看錯誤的gem文件)

將“gem'pg'”添加到Gemfile中修復它。 感謝'畝太短'

我的問題是我實際上並不知道在哪里編輯gemfile(最初查看錯誤的gem文件)

將“gem'pg'”添加到Gemfile中修復它。 感謝'畝太短'

在ubuntu上,我就是這么做的

apt-get install libpgsql-ruby

幾個星期前我遇到了這樣的問題。 我想你應該首先嘗試將此代碼添加到boot.rb文件中。

require 'yaml'
YAML::ENGINE.yamler = 'syck'

您還應該嘗試將此添加到grmfile並立即運行bundle install

gem 'pg'

如果它也有幫助,這是我的database.yml文件的示例。 希望它有效!

production:
  adapter: postgresql
  encoding: unicode
  database: dezirus
  username: postgres
  password: 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM