相关疑难解决方法(0)

无法安装pg gem

我尝试使用,gem install pg但它似乎没有用.

gem install pg 给出了这个错误

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

C:/Ruby/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. …
Run Code Online (Sandbox Code Playgroud)

ruby installation rubygems ruby-on-rails

209
推荐指数
10
解决办法
13万
查看次数

PGError:错误:关系"table_name"不存在

我正在尝试将一个简单的应用程序推送到heroku并运行:

heroku rake db:migrate
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

rake aborted!
PGError: ERROR:  relation "posts" does not exist
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '"posts"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

我的迁移看起来像这样:

class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts do |t|
      t.string :source
      t.string :tweetid
      t.string …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql ruby-on-rails heroku ruby-on-rails-3

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