no such file to load — rdoc/task
-
27-10-2019 - |
题
When I run
rake db:create
I receive this error
rake aborted!
no such file to load -- rdoc/task
(See full trace by running task with --trace)
Here is the --trace
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/tpeg/rails_apps/Test/Rakefile:8
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:78:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:61:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/bin/rake:32
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
I have rake 0.9.2 and rdoc 3.11 installed. I am running these commands in my app's directory.
解决方案
I had the same problem.
I solved it by adding gem 'rdoc'
to my Gemfile and then run bundle install
.
其他提示
If you're not using a Gemfile, it's likely that switching your line in your Rakefile from this:
require 'rake/rdoctask'
to this
require 'rdoc/task'
will work. It did for me.
Also try a
gem install rdoc
You can actually trap for this in your Rakefile should you have different rake versions between environments. We are this way with older production applications.
begin
require 'rake/rdoctask'
rescue
require 'rdoc/task'
end
If you're working on an app without a Gemfile (like a legacy with rails 2.3 --), you can install the gem rdoc manually:
gem install rdoc
不隶属于 StackOverflow