![](/img/trans.png)
[英]NoMethodError undefined method `configure' for #<Sinatra::Application>
[英]NoMethodError: undefined method `task' for Sinatra::Application:Class
這是我運行任何 rake 命令時得到的錯誤:Sinatra::Application:Class 的未定義方法“任務”
# Rakefile
require 'sinatra/activerecord'
require 'sinatra/activerecord/rake'
require_relative './config/environment'
Dir.glob('lib/tasks/*.rake').each { |r| load r}
#lib/tasks/test_report.rake
namespace :test_report do
task :generate => :environment do
...
end
end
當我嘗試運行命令時遇到了上述錯誤。
bundle exec rake test_report:generate
您正在嘗試使用 rake API,但未加載。 將此添加到您的文件頂部。
require 'rake'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.