2013-06-20 8 views
5

Ich habe gerade begonnen, Ruby auf Schienen zu lernen. Ich habe pg gem installiert wie unten gezeigt. Und 'pg' ist sowohl in gemfile.lock als auch in gemfile. Es wird jedoch weiterhin ein Fehler angezeigt, "Gem wurde nicht geladen. Füge gem 'pg' zu deiner Gemdatei hinzu."Fehler kann 'pg' Juwel auf lokalen Windows 7 nicht laden Ruby on Rails

Ich habe auch versucht, jemandes Rat folgen, löschen Sie die gemfile.lock und re-Bundle. Derselbe Fehler ist aufgetreten.

E:\RoR docs\first_app>bundle show pg 
Could not find gem 'pg'. 
Did you mean pg? 

gemfile:

source 'https://rubygems.org' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.0.0.rc2' 

# Use sqlite3 as the database for Active Record 
gem 'pg' 

# Use SCSS for stylesheets 
gem 'sass-rails', '~> 4.0.0.rc2' 

# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 

# Use CoffeeScript for .js.coffee assets and views 
gem 'coffee-rails', '~> 4.0.0' 

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

# Use jquery as the JavaScript library 
gem 'jquery-rails' 

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 1.2' 

group :doc do 
    # bundle exec rake doc:rails generates the API under doc/api. 
    gem 'sdoc', require: false 
end 

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

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

# Use Capistrano for deployment 
# gem 'capistrano', group: :development 

# Use debugger 
# gem 'debugger', group: [:development, :test] 

database.yml:

# SQLite version 3.x 
# gem install sqlite3 
# 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem 'sqlite3' 
development: 
    adapter: postgresql 
    database: first_app 
    pool: 5 
    username: postgres 
    password: admin 
    port: 5432 
    timeout: 5000 
    host: localhost 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: sqlite3 
    database: db/test.sqlite3 
    pool: 5 
    timeout: 5000 

production: 
    adapter: sqlite3 
    database: db/production.sqlite3 
    pool: 5 
    timeout: 5000 

gem Liste:

*** LOCAL GEMS *** 

actionmailer (4.0.0.rc2, 3.2.13) 
actionpack (4.0.0.rc2, 3.2.13) 
activemodel (4.0.0.rc2, 3.2.13) 
activerecord (4.0.0.rc2, 3.2.13) 
activerecord-deprecated_finders (1.0.3) 
activerecord-postgresql-adapter (0.0.1) 
activeresource (3.2.13) 
activesupport (4.0.0.rc2, 3.2.13) 
ansi (1.4.3) 
arel (4.0.0, 3.0.2) 
atomic (1.1.9) 
bigdecimal (1.2.0) 
builder (3.2.2, 3.1.4, 3.0.4) 
bundler (1.3.5) 
capybara (2.1.0) 
coffee-rails (4.0.0, 3.2.2) 
coffee-script (2.2.0) 
coffee-script-source (1.6.2) 
diff-lcs (1.2.4) 
erubis (2.7.0) 
execjs (1.4.0) 
formatador (0.2.4) 
guard (1.8.1) 
guard-rspec (3.0.2) 
hike (1.2.3) 
i18n (0.6.4, 0.6.1) 
io-console (0.4.2) 
jason (0.6.0) 
jbuilder (1.4.2) 
journey (1.0.4) 
jquery-rails (3.0.1) 
json (1.8.0, 1.7.7) 
listen (1.2.2) 
lumberjack (1.0.3) 
mail (2.5.4) 
mime-types (1.23) 
mini_portile (0.5.0) 
minitest (5.0.4, 4.7.4, 4.3.2) 
multi_json (1.7.7) 
pg (0.15.1 x64-mingw32) 
pik (0.2.8) 
polyglot (0.3.3) 
psych (2.0.0) 
rack (1.5.2, 1.4.5) 
rack-cache (1.2) 
rack-ssl (1.3.3) 
rack-test (0.6.2) 
rails (4.0.0.rc2, 3.2.13) 
railties (4.0.0.rc2, 3.2.13) 
rake (10.1.0, 0.9.6) 
rb-fsevent (0.9.3) 
rb-inotify (0.9.0) 
rb-kqueue (0.2.0) 
rdiscount (2.1.6) 
rdoc (4.0.1, 4.0.0, 3.12.2) 
rspec (2.13.0) 
rspec-core (2.13.1) 
rspec-expectations (2.13.0) 
rspec-mocks (2.13.1) 
rspec-rails (2.13.2) 
sass (3.2.9) 
sass-rails (4.0.0.rc2, 3.2.6) 
sdoc (0.3.20) 
sprockets (2.10.0, 2.2.2) 
sprockets-rails (2.0.0) 
test-unit (2.5.5, 2.0.0.0) 
thor (0.18.1) 
thread_safe (0.1.0) 
tilt (1.4.1) 
treetop (1.4.14) 
turbolinks (1.2.0) 
turn (0.9.6, 0.8.2) 
tzinfo (1.0.0, 0.3.37) 
uglifier (2.1.1) 
xpath (2.0.0) 

Bundle:

E:\RoR docs\first_app>bundle 
Using rake (10.1.0) 
Using i18n (0.6.4) 
Using minitest (4.7.4) 
Using multi_json (1.7.7) 
Using atomic (1.1.9) 
Using thread_safe (0.1.0) 
Using tzinfo (0.3.37) 
Using activesupport (4.0.0.rc2) 
Using builder (3.1.4) 
Using erubis (2.7.0) 
Using rack (1.5.2) 
Using rack-test (0.6.2) 
Using actionpack (4.0.0.rc2) 
Using mime-types (1.23) 
Using polyglot (0.3.3) 
Using treetop (1.4.14) 
Using mail (2.5.4) 
Using actionmailer (4.0.0.rc2) 
Using activemodel (4.0.0.rc2) 
Using activerecord-deprecated_finders (1.0.3) 
Using arel (4.0.0) 
Using activerecord (4.0.0.rc2) 
Using coffee-script-source (1.6.2) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using thor (0.18.1) 
Using railties (4.0.0.rc2) 
Using coffee-rails (4.0.0) 
Using hike (1.2.3) 
Using jbuilder (1.4.2) 
Using jquery-rails (3.0.1) 
Using json (1.8.0) 
Using bundler (1.3.5) 
Using tilt (1.4.1) 
Using sprockets (2.10.0) 
Using sprockets-rails (2.0.0) 
Using rails (4.0.0.rc2) 
Using rdoc (3.12.2) 
Using sass (3.2.9) 
Using sass-rails (4.0.0.rc2) 
Using sdoc (0.3.20) 
Using turbolinks (1.2.0) 
Using uglifier (2.1.1) 
Your bundle is complete! 
Use `bundle show [gemname]` to see where a bundled gem is installed. 

gemfile.lock:

GEM 
    remote: https://rubygems.org/ 
    specs: 
    actionmailer (4.0.0.rc2) 
     actionpack (= 4.0.0.rc2) 
     mail (~> 2.5.3) 
    actionpack (4.0.0.rc2) 
     activesupport (= 4.0.0.rc2) 
     builder (~> 3.1.0) 
     erubis (~> 2.7.0) 
     rack (~> 1.5.2) 
     rack-test (~> 0.6.2) 
    activemodel (4.0.0.rc2) 
     activesupport (= 4.0.0.rc2) 
     builder (~> 3.1.0) 
    activerecord (4.0.0.rc2) 
     activemodel (= 4.0.0.rc2) 
     activerecord-deprecated_finders (~> 1.0.2) 
     activesupport (= 4.0.0.rc2) 
     arel (~> 4.0.0) 
    activerecord-deprecated_finders (1.0.3) 
    activesupport (4.0.0.rc2) 
     i18n (~> 0.6, >= 0.6.4) 
     minitest (~> 4.2) 
     multi_json (~> 1.3) 
     thread_safe (~> 0.1) 
     tzinfo (~> 0.3.37) 
    arel (4.0.0) 
    atomic (1.1.9) 
    builder (3.1.4) 
    coffee-rails (4.0.0) 
     coffee-script (>= 2.2.0) 
     railties (>= 4.0.0.beta, < 5.0) 
    coffee-script (2.2.0) 
     coffee-script-source 
     execjs 
    coffee-script-source (1.6.2) 
    erubis (2.7.0) 
    execjs (1.4.0) 
     multi_json (~> 1.0) 
    hike (1.2.3) 
    i18n (0.6.4) 
    jbuilder (1.4.2) 
     activesupport (>= 3.0.0) 
     multi_json (>= 1.2.0) 
    jquery-rails (3.0.1) 
     railties (>= 3.0, < 5.0) 
     thor (>= 0.14, < 2.0) 
    json (1.8.0) 
    mail (2.5.4) 
     mime-types (~> 1.16) 
     treetop (~> 1.4.8) 
    mime-types (1.23) 
    minitest (4.7.4) 
    multi_json (1.7.7) 
    pg (0.15.1-x86-mingw32) 
    polyglot (0.3.3) 
    rack (1.5.2) 
    rack-test (0.6.2) 
     rack (>= 1.0) 
    rails (4.0.0.rc2) 
     actionmailer (= 4.0.0.rc2) 
     actionpack (= 4.0.0.rc2) 
     activerecord (= 4.0.0.rc2) 
     activesupport (= 4.0.0.rc2) 
     bundler (>= 1.3.0, < 2.0) 
     railties (= 4.0.0.rc2) 
     sprockets-rails (~> 2.0.0) 
    railties (4.0.0.rc2) 
     actionpack (= 4.0.0.rc2) 
     activesupport (= 4.0.0.rc2) 
     rake (>= 0.8.7) 
     thor (>= 0.18.1, < 2.0) 
    rake (10.1.0) 
    rdoc (3.12.2) 
     json (~> 1.4) 
    sass (3.2.9) 
    sass-rails (4.0.0.rc2) 
     railties (>= 4.0.0.beta, < 5.0) 
     sass (>= 3.1.10) 
     sprockets-rails (~> 2.0.0) 
    sdoc (0.3.20) 
     json (>= 1.1.3) 
     rdoc (~> 3.10) 
    sprockets (2.10.0) 
     hike (~> 1.2) 
     multi_json (~> 1.0) 
     rack (~> 1.0) 
     tilt (~> 1.1, != 1.3.0) 
    sprockets-rails (2.0.0) 
     actionpack (>= 3.0) 
     activesupport (>= 3.0) 
     sprockets (~> 2.8) 
    thor (0.18.1) 
    thread_safe (0.1.0) 
     atomic 
    tilt (1.4.1) 
    treetop (1.4.14) 
     polyglot 
     polyglot (>= 0.3.1) 
    turbolinks (1.2.0) 
     coffee-rails 
    tzinfo (0.3.37) 
    uglifier (2.1.1) 
     execjs (>= 0.3.0) 
     multi_json (~> 1.0, >= 1.0.2) 

PLATFORMS 
    x86-mingw32 

DEPENDENCIES 
    coffee-rails (~> 4.0.0) 
    jbuilder (~> 1.2) 
    jquery-rails 
    pg (= 0.15.1) 
    rails (= 4.0.0.rc2) 
    sass-rails (~> 4.0.0.rc2) 
    sdoc 
    turbolinks 
    uglifier (>= 1.3.0) 

pgAdminIII ist und läuft: enter image description here

Fehlerseite:

enter image description here

Antwort

6

Ihre gem Liste zeigt:

pg (0.15.1 x64-mingw32)

Aber Ihre Gemfile.lock zeigt

PLATFORMS x86-mingw32

Ich denke, Ihr Problem bezieht sich auf eine gemischte Plattform (32 Bit (x86) vs 64 Bit (x64))

Versuchen Sie zu investieren legate das.

+0

Guter Punkt! Vielen Dank. Würdest du mir bitte sagen, wie man Bundle x64 Bit Version Version erzwingen? Ich bin ein dummer Neuling. x64 pg gem ist bereits in der Edelsteinliste. –

+1

Ich denke, Sie sollten MinGW 64 Bits installieren: http://qt-project.org/wiki/MinGW-64-bit und löschen Sie Gemfile.lock und führen Sie dann Bundle-Installation erneut aus. Aber ich bin mir nicht sicher. – Aguardientico

+0

Sie können auch versuchen, pg gem mit dem folgenden Befehl zu installieren: 'gem install pg --platform = mswin32' – Aguardientico

0

Wie sind Sie mit dem Server? Try Bündel exec Schienen s

+0

Erstens, vielen Dank für Ihren Vorschlag. Ich habe einen ganzen Tag gewartet. Schließlich antwortete ein guter Mann. Ich habe gerade versucht Bündel Exec Schienen s. Gleiche Fehlerseite. –

+1

Ich sehe PG nicht in der Liste der installierten Edelsteine ​​(Ausgabe des Bündelbefehls, den Sie eingefügt haben). Aber ich sehe es im gemfile.lock. Sehr komisch. Wie wäre es mit "Bundle installieren" noch einmal? – pedz

+0

Danke für die Beratung @pedz. Ja, ich habe es versucht. Immer noch die gleiche Fehlerseite. –

Verwandte Themen