新手问题 rails 项目执行 rake db:migrate 时候遇到如下错误,希望大神帮忙看看

sanm1992 · 2018年08月19日 · 最后由 sanm1992 回复于 2018年08月20日 · 2236 次阅读

如题:rails 项目执行 rake db:migrate 时候遇到如下错误

/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:606: warning: constant ::Fixnum is deprecated
rake aborted!
ArgumentError: wrong number of arguments (given 4, expected 1)
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:1066:in `type_to_sql'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:520:in `type_to_sql'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_creation.rb:19:in `type_to_sql'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_creation.rb:34:in `visit_ColumnDefinition'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_creation.rb:16:in `accept'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_creation.rb:47:in `block in visit_TableDefinition'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_creation.rb:47:in `map'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_creation.rb:47:in `visit_TableDefinition'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_creation.rb:16:in `accept'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:311:in `create_table'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:439:in `create_table'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/schema_migration.rb:29:in `create_table'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1187:in `initialize'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in `new'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in `up'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:in `migrate'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

ruby -v 2.4.0 rails -v 5.2.1

database.ym 配置是这样的

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  host: 39.108.184.220
  port: 3306
  username: username
  password: password

development:
  <<: *default
  database: sanm_dev

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: sanm_test

production:
  <<: *default
  database: sanm_pro

gemfile 中相关是这样的

gem 'mysql2', '~>0.3.6'
gem 'activerecord-mysql2-adapter'

不是很明白发什么了什么,并且要怎么解决,希望大神们帮忙看看,指点一下

用这个 gem activerecord-mysql2-adapter 做啥?

https://github.com/kronn/activerecord-mysql2-adapter

6 年没更新了,看来只是 ActiveRecord 没支持 mysql2 之前的过度 gem,应该会产生冲突。

2 楼 已删除
Rei 回复

用这个 gem 是因为之前跑 rake db:migrate 时候出现如下错误:

rake aborted!
Gem::LoadError: Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
/usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'

Caused by:
Gem::LoadError: can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
/usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)

貌似说缺少一些依赖,当时不知道这个 gem 基本被弃用,环境也是之前一直用的,不是很明白为什么会这样

诶,在尝试了重装 mysql 之后,我怀疑是 ruby 版本太低,升级了 ruby 为 2.5.0,还是不行,那应该改是 rails 版本问题,我把 rails 版本回退到 5.1.4 然后一切都好了,但是我依然不明到底是怎么回事,rails5.2.1 到底和我本地环境有什么冲突

去掉 activerecord-mysql2-adapter 了没。

Rei 回复

去掉了

sanm1992 回复

然后呢?什么错?

8 楼 已删除
9 楼 已删除

去掉后错误日志是这样:

rake aborted!
Gem::LoadError: Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
/usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'

Caused by:
Gem::LoadError: can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
/usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
/usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
Rei 回复

错误日志在楼上,不知道为什么粘贴了错误日志没有回复某个人的格式

can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21

版本不符合要求,bundle update mysql2

Rei 回复

非常感谢,已经可以了🙏

sanm1992 关闭了讨论。 08月20日 15:05
需要 登录 后方可回复, 如果你还没有账号请 注册新账号