devployment
devployment

Reputation: 2201

Why rake aborts [rake --tasks] with cannot load such file on my Windows box?

I'm trying to execute a rake task from a directory without rails or anything. Just a directory and a Rakefile.rb inside.

Currently I have no idea why it fails. But I thought executing rake from within a directory where a Rakefile lives should execute the tasks from this rakefile. Am I missing a load path or something?

My environment

Win7 (x64)

ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

rake, version 0.9.2.2

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby193/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby193/lib/ruby/gems/1.9.1
     - C:/Users/pantarhei/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

This are the error message

[rake --tasks] rake aborted!
cannot load such file -- D:/Projects/_Web/FOO/Rakefile
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load'
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:65:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'


    [rake --prereqs] rake aborted!
cannot load such file -- D:/Projects/_Web/FOO/Rakefile
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load'
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:65:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'

Upvotes: 1

Views: 1644

Answers (2)

Anupam
Anupam

Reputation: 1530

Can you try renaming Rakefile.rb to Rakefile (without the .rb extension), and then try again?

Also try if:

rake -T -fRakefile.rb

works.

Upvotes: 1

Paul Richter
Paul Richter

Reputation: 11072

In the question you wrote Reakefile.rb; I don't know whether this is a typo solely in the question or whether your rakefile in the directory is actually called this, but make sure it is called Rakefile, or Rakefile.rb.

Upvotes: 0

Related Questions