当运行rake/rails命令时,我得到`typeerror:class命令的超类不匹配`

bqucvtff  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(186)

我尝试在linux上使用rails/rake运行命令,如下所示: rails db:resetrake --tasks . 但当我这样做时,我会得到以下错误:

$ rake --tasks
rake aborted!
TypeError: superclass mismatch for class Command
/var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:2:in `<class:Thor>'
/var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:1:in `<main>'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/lib/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
/var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:1:in `<main>'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/lib/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
/var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/group.rb:1:in `<main>'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/lib/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/generators.rb:6:in `<main>'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/lib/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/app_updater.rb:3:in `<main>'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/lib/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/tasks/framework.rake:41:in `block (2 levels) in <main>'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/tasks/framework.rake:40:in `block in <main>'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/tasks/framework.rake:3:in `<main>'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:77:in `load'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:77:in `load'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `block in load'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `load'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/tasks.rb:22:in `block in <main>'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/tasks.rb:21:in `each'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/tasks.rb:21:in `<main>'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/lib/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/lib/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/application.rb:519:in `run_tasks_blocks'
/var/lib/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/engine.rb:459:in `load_tasks'
/home/momentus/stackshine/Rakefile:9:in `<top (required)>'
/usr/share/rubygems-integration/all/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

bundle exec 命令前面的命令不起作用。唯一免于此错误(afaik)的命令是 rails srails c .
这是我的档案:

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "2.7.1"

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'

gem "rails", "~> 6.0.3", ">= 6.0.3.2"

# Use postgresql as the database for Active Record

gem "pg", ">= 0.18", "< 2.0"

# Use Puma as the app server

gem "puma", "~> 4.1"

# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker

gem "webpacker", "~> 4.0"

# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks

gem "turbolinks", "~> 5"

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

gem "jbuilder", "~> 2.7"

# Use Redis adapter to run Action Cable in production

# gem 'redis', '~> 4.0'

# Use Active Model has_secure_password

# gem 'bcrypt', '~> 3.1.7'

# Offer a real backend for ActiveJob

gem "resque"
gem "resque-scheduler"
gem "resque-web", require: "resque_web"

# Turbocharge complex front-end components

gem "react-rails"

# Integrate directly with our team chat

gem "discordrb"

# Use Active Storage variant

# gem 'image_processing', '~> 1.2'

# Add .active class to links when they're being presented

gem "active_link_to"

# Tell StatsD about request time, GC, objects and more.

gem "barnes"

# Save time on form stuff

gem "simple_form"

# Authentication via Auth0

gem "omniauth-auth0", "~> 2.2"
gem "omniauth-rails_csrf_protection", "~> 0.1"

# Reduces boot times through caching; required in config/boot.rb

gem "bootsnap", ">= 1.4.2", require: false

# Scrape websites to extract vendor data

gem "kimurai"

# Name management

gem "name_of_person"

# Allow models to be tagged

gem "acts-as-taggable-on", "~> 6.0"

# Keep track of env vars alongside the app

gem "dotenv-rails", groups: [:development, :test]

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
  gem "pry-rails"
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem "web-console", ">= 3.3.0"
  gem "listen", "~> 3.2"
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem "spring"
  gem "spring-watcher-listen", "~> 2.0.0"

  gem "better_errors"
  gem "binding_of_caller"

  # Watch for n+1 queries to maintain performance
  gem "bullet"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem

gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem "selenium-webdriver"

gem "aws-sdk-s3", require: false

gem "plaid"

gem "stripe"
gem "stripe_event" # webhook library

gem "sentry-ruby"
gem "sentry-rails"

gem "paranoia", "~> 2.2"

gem "rails_admin", "~> 2.0"

gem "sib-api-v3-sdk"

gem "google-apis-admin_directory_v1"
gem "google-apis-admin_reports_v1"

gem "google-id-token"

# Quickbooks Online API library

gem "quickbooks-ruby"

gem "httparty"

gem 'rack-reverse-proxy', :require => 'rack/reverse_proxy'

gem "noticed", git: "https://github.com/excid3/noticed"

gem "newrelic_rpm"

gem "storext"

gem "multipart-parser"

gem "cancancan"

gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题