No such file to load -- postgres (newbie)

Ok,

Completely new to Rails here and have just started running through some
tutorials using

Netbeans 6
Postgres 8.3 beta
Windows Vista

I’m looking at migration and trying to get my head round that, but each
time I run a migration I get this error

rake aborted!
no such file to load – postgres

(See full trace by running task with --trace)

I’ve looked at the trace and cant see anything of use in there but I’ve
stuck it at the bottom of the post anyway.

So does anyone know what the problem could be?

Cheers
Tony

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
no such file to load – postgres
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/kernel/requires.rb:19:in
require_library_or_gem' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/postgresql_adapter.rb:7:insilence_warnings’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/kernel/requires.rb:5:in
require_library_or_gem' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/postgresql_adapter.rb:7:inpostgresql_connection’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in
send' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:inconnection=’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/query_cache.rb:54:in
connection=' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:230:inretrieve_connection’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
connection' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/migration.rb:284:inmigrate’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/tasks/databases.rake:4
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/tasks/rails.rb:4:in
call' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in
each' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in
invoke' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:insynchronize’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in
invoke' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:intop_level’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in
each' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:intop_level’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in
standard_exception_handling' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:intop_level’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in
run' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7:instandard_exception_handling’
C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in
run' C:/Program Files (x86)/NetBeans 6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7 :1:inload’
:1

You need to install the postgres and/or ruby-postgres gems. I’m not
sure if both are needed as I’ve had it installed for a while now and
can’t remember. Beyond that, I believe the adapter name in the
database.yml file should be postgresql not just postgres.

Peace,
Phillip

Cheers Mate,

So I’m now trying to install the gem and this is what I get

Building native extensions. This could take a while…
Error opening script file: extconf.rb (The system cannot find the file
specified)
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install postgres --no-rdoc --no-ri
–include-dependencies --version > 0

Gem files will remain installed in C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/postgres-0.7.1 for
inspection.
Results logged to C:/Program Files (x86)/NetBeans
6.0/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/postgres-0.7.1/gem_make.out

Any Ideas anyone?

It looks like you’re missing some development libraries, but I’m not
sure which one(s). I’ve never tried to get rails working on a
Windows box, so I really can’t be of much more help. On *nix, I’d
probably make sure I have ruby-dev installed for the version of ruby
I’m using. You could look around and see if there is a ruby
development installation for Windows.

Peace,
Phillip

Mathew M. wrote:

Its all sorted now…I installed postgres-pr

and its worked a treat

thanks for your help phillip

Plz load ‘rubygems’ before ‘postgres’. For example

require ‘rubygems’
require ‘postgres’

…rest of the code…

May solve ur problem.

Mathew M. wrote:

Ok,

Completely new to Rails here and have just started running through some
tutorials using

Netbeans 6
Postgres 8.3 beta
Windows Vista

Glad you got it working. Just as a side issue, I’d suggest dropping
NetBeans and Windows. Rails development is actually better without an
IDE IMHO – try a good editor such as KomodoEdit instead – and
certainly as you’re just learning the framework, you should not have
NetBeans getting in your way. And you’ll probably have fewer problems
if you’re running some sort of *nix (including Mac OS or a VM –
VirtualRails seems to be causing something of a splash).

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Its all sorted now…I installed postgres-pr

and its worked a treat

thanks for your help phillip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs