Rake: "no such file to load" although it exists

Posted on 26 May 2009 by Johannes Fahrenkrug. Tags: Programming Ruby
I'm working on a search extension for the Radiant CMS that uses Xapian at the moment. I ran into a weird issue where rake complained about not being able to load a file although it existed. It listed the full - and correct - path of the rake file I wanted to include in another rake file and aborted with "no such file to load". Lies! All lies! Reading the RDoc of Rake revealed that dependencies loaded with "require" are loaded before the Rake targets are evaluated. So alternatively you can use the "import" statement instead of "require". That's what solved my problem. The "no such file to load" error is quite misleading, though.

Comments

Please keep it clean, everybody. Comments with profanity will be deleted.

blog comments powered by Disqus