标签: pg

用'gem pq'安装PostgreSQL gem失败了ERROR:无法构建gem native扩展

我正在学习Ruby on Rails并尝试开发一个应用程序.在我的应用我试图使用默认的开发模式SQLite数据库PostgreSQL的在生产模式.但是在尝试使用以下命令安装pg gem时出现以下错误:gem install pg

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.
 
    /home/tusharkhatiwada/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev
 for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev
 for building a client-side application.
checking for libpq-fe.h... no
Can't …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql gem ruby-on-rails pg

34
推荐指数
1
解决办法
2万
查看次数

gem install pg在OSX Lion上不起作用

这个问题有各种各样的变化,但是它们似乎都没有解决我问题的答案.

我正在运行OSX Lion(10.7.3).安装了最新的XCode.

我使用postgresapp.com的Postgres.app包安装了Postgres.

但是当我尝试安装pg gem时,我遇到了失败:

$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

        /Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
checking for libpq-fe.h... *** 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 need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql rubygems pg osx-lion

31
推荐指数
6
解决办法
3万
查看次数

试图为ror app设置postgres,收到错误 - fe_sendauth:没有提供密码

获得:

An error has occurred:

Error connecting to the server: fe_sendauth: no password supplied
Run Code Online (Sandbox Code Playgroud)

设置database.yml与其他计算机上的应用程序设置相同.

如何设置以便我不需要硬编码的密码?

我可以使用PgAdmin-III查看db ok.

我宁愿没有密码,database.yml因为使用这个应用程序的其他机器没有/需要它,所以它似乎可能与我的Pg安装有关.

ruby passwords postgresql ruby-on-rails pg

26
推荐指数
2
解决办法
6万
查看次数

什么时候断开连接以及何时结束pg客户端或池

我的堆栈是node,express和pg模块.我真的试图通过文档和一些过时的教程来理解.我不知道何时以及如何断开连接并结束客户端.

对于某些路线,我决定使用游泳池.这是我的代码

const pool = new pg.Pool({
  user: 'pooluser',host: 'localhost',database: 'mydb',password: 'pooluser',port: 5432});

pool.on('error', (err, client) => {
  console.log('error ', err);  process.exit(-1);
});

app.get('/', (req, res)=>{
  pool.connect()
    .then(client => {
      return client.query('select ....')
            .then(resolved => {
              client.release();
              console.log(resolved.rows);
            })
            .catch(e => { 
              client.release();
              console.log('error', e);
            })
      pool.end();
    })
});
Run Code Online (Sandbox Code Playgroud)

在CMS的路由中,我使用客户端而不是具有与池不同的数据库权限的池.

const client = new pg.Client({
  user: 'clientuser',host: 'localhost',database: 'mydb',password: 'clientuser',port: 5432});    
client.connect();

const signup = (user) => {
  return new Promise((resolved, rejeted)=>{
    getUser(user.email)
    .then(getUserRes => {
      if (!getUserRes) { …
Run Code Online (Sandbox Code Playgroud)

postgresql node.js pg node-postgres

24
推荐指数
4
解决办法
9515
查看次数

gem install pg无法绑定到libpq

在Ubuntu 10.04.3上升级到Ruby 1.9.3(使用系统RVM的1.9.2)后,我删除了所有的宝石,并尝试重新安装pg(ala bundle install pg).

然后它抛出一个错误并通知我,我应该看看mkmf.log,这两个都包含在这个要点中:https://gist.github.com/d05a81701d968895c730

libpq-dev,libpq5和postgresql-client都已​​安装并正常运行.在pg_config中指向gem,直接指向include和bin目录似乎没有任何改变.

我已经看到几个关于stackoverflow和网络其余部分的类似错误消息的问题,但它们似乎都很简单,缺少依赖性问题(大多数是通过安装libpq-dev解​​决的),所以我有点亏损

可能有用/相关的各种其他属性:

  • ruby 1.9.3p0(2011-10-30修订版33570)[i686-linux]
  • rvm 1.10.1(系统)
  • 宝石1.8.15
  • psql(PostgreSQL)8.4.9

提前致谢.

gem_make.out:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql ubuntu pg ruby-1.9.3

23
推荐指数
1
解决办法
7681
查看次数

更新到OS X 10.9 Mavericks后,对Rails和postgres的麻烦

更新到OS X 10.9 Mavericks后,我尝试启动Rails 3应用程序,但是与PG数据库的连接无法正常工作.检查PGAdmin III,数据库仍在那里,它工作正常.所以我尝试重新安装pg gem:

gem uninstall pg
gem install pg
Run Code Online (Sandbox Code Playgroud)

但是最后一个命令没有成功,并给出以下错误:

构建原生扩展.这可能需要一段时间...错误:安装pg时出错:

错误:无法构建gem原生扩展.

    /Users/XXX/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb checking for pg_config... yes Using config values from
Run Code Online (Sandbox Code Playgroud)

/ usr/local/bin/pg_config *extconf.rb失败*由于某些原因无法创建Makefile,可能缺少必要的库和/或头文件.检查mkmf.log文件以获取更多详细信息.您可能需要配置选项.

/Users/XXX/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in`try_do':编译器无法生成可执行文件.

(RuntimeError)您必须首先安装开发工具.来自/Users/XXX/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in try_link0' from /Users/XXX/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in try_link'来自extconf.rb:39:in''

我想这个问题与Xcode开发人员工具有关.我将Xcode更新到最新版本,但这并没有解决问题.你知道怎么解决吗?

postgresql ruby-on-rails pg osx-mavericks

20
推荐指数
3
解决办法
1万
查看次数

PG ::错误:错误:关系"用户"不存在

抱歉打扰你,但我对这个错误有很多疑问.首先这是我的user_controller rspec文件

需要'spec/spec_helper'

describe UserController do

it "create new user" do
    post "create"
    assigns[:users].should_not be_new_record
end
end
Run Code Online (Sandbox Code Playgroud)

这是我的UserController

 class UserController < ApplicationController
   def create
     @users = User.new
     if @users.save
       flash[:notice] = 'new user was successfully created.'
     else
       render :action => :new
     end
   end

   def new
     @user = User.new
   end
 end
Run Code Online (Sandbox Code Playgroud)

和我的routes.rb(我认为问题在这里,对不起,但我是这种语言的新手)

Estaciones::Application.routes.draw do
  devise_for :users

  root :to => "home#index"
  resources :user
end
Run Code Online (Sandbox Code Playgroud)

当我尝试测试我的user_controller_rspec然后我得到这个错误

失败:

1) UserController create new user
   Failure/Error: post "create"
   ActiveRecord::StatementInvalid:
     PG::Error: ERROR:  relation "users" does not exist …
Run Code Online (Sandbox Code Playgroud)

testing rspec ruby-on-rails pg

19
推荐指数
1
解决办法
1万
查看次数

在postgres中为没有时区的数据类型时间戳插入语句NOT NULL,

数据库noob警报:我试图插入postgres表.我想要插入的字段被调用make_date.

字段类型是timestamp without time zone NOT NULL,如何在此处插入今天的日期?就像现在的日期和时间?像下面的东西,但我无法获得dateTime.now正确的数据类型插入格式

insert into inventory_tbl (make_date) values (dateTime.now)
Run Code Online (Sandbox Code Playgroud)

postgresql pg

19
推荐指数
2
解决办法
6万
查看次数

为什么不能在AWS Elastic Beanstalk中安装pg gem?

我正在向AWS Elastic Beanstalk部署一个简单的应用程序.然而,此刻我把gem 'pg'Gemfile与这些推到弹性魔豆.我的日志中出现以下错误:

-------------------------------------
/var/log/eb-tools.log
-------------------------------------
Installing actionpack (4.0.1) 
Installing mime-types (1.25) 
Installing polyglot (0.3.3) 
Installing treetop (1.4.15) 
Installing mail (2.5.4) 
Installing actionmailer (4.0.1) 
Installing activemodel (4.0.1) 
Installing activerecord-deprecated_finders (1.0.3) 
Installing arel (4.0.1) 
Installing activerecord (4.0.1) 
Installing coffee-script-source (1.6.3) 
Installing execjs (2.0.2) 
Installing coffee-script (2.2.0) 
Installing thor (0.18.1) 
Installing railties (4.0.1) 
Installing coffee-rails (4.0.1) 
Installing hike (1.2.3) 
Installing jbuilder (1.5.2) 
Installing jquery-rails (3.0.4) 
Using json (1.8.1) 
Installing pg (0.17.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails amazon-web-services pg amazon-elastic-beanstalk

18
推荐指数
1
解决办法
3360
查看次数

pg.connect不是一个功能?

似乎有很多文档(例如https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js,但也包括这个网站在其他地方),表明正确的方法与pg.js Node包正在使用pg.connect.但是,我尝试使用上述Heroku文档中显示的确切代码(在我之前的实际代码问题之后)进行测试:

var pg = require('pg');

pg.defaults.ssl = true;
pg.connect(process.env.DATABASE_URL, function(err, client) {
  if (err) throw err;
  console.log('Connected to postgres! Getting schemas...');

  client
    .query('SELECT table_schema,table_name FROM information_schema.tables;')
    .on('row', function(row) {
      console.log(JSON.stringify(row));
    });
});
Run Code Online (Sandbox Code Playgroud)

我收到错误消息"pg.connect不是一个函数".发生了什么,我该如何解决?

heroku node.js pg

18
推荐指数
2
解决办法
2万
查看次数