我尝试用引导方式运行rails c和rails时出错

时间:2019-06-01 15:56:27

标签: ruby-on-rails ruby rails-console

我从rails开始,当我尝试运行rails c和rails s时,遇到要求我的错误。前一天工作正常。我的rspec正在工作。

我已经尝试删除引导程序,但是没有用。

我的宝石文件:

ruby '2.4.3'

gem 'rails', '~> 5.2.3'
gem 'sqlite3'
gem 'puma', '~> 3.11'

gem 'bootsnap', '>= 1.1.0', require: false
gem 'sprockets-rails', '~> 3.0.4'
gem 'materialize-sass', '~> 1.0.0'
gem 'devise'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'rspec-rails', '~> 3.8'
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'factory_bot_rails'
  gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
end

group :test do
  gem 'shoulda-matchers'
end

group :development do
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end


# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

错误:

/home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap- 
1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in 
`require': cannot load such file -- rails_helper (LoadError)
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap- 
  1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in 
  `block in require_with_bootsnap_lfi'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap- 
  1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in 
  `register'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap- 
1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:40:in `rescue in require'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:26:in `require'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
    from /home/norton/workspace/IotNotificationManager/spec/factories/devices.rb:1:in `<main>'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot-5.0.2/lib/factory_bot/find_definitions.rb:20:in `block (2 levels) in find_definitions'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot-5.0.2/lib/factory_bot/find_definitions.rb:19:in `each'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot-5.0.2/lib/factory_bot/find_definitions.rb:19:in `block in find_definitions'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot-5.0.2/lib/factory_bot/find_definitions.rb:15:in `each'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot-5.0.2/lib/factory_bot/find_definitions.rb:15:in `find_definitions'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot-5.0.2/lib/factory_bot/reload.rb:6:in `reload'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot_rails-5.0.2/lib/factory_bot_rails/reloader.rb:25:in `block in build_reloader'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/evented_file_update_checker.rb:83:in `execute'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/factory_bot_rails-5.0.2/lib/factory_bot_rails/reloader.rb:35:in `block in register_reloader'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:426:in `instance_exec'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:426:in `block in make_lambda'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:605:in `catch'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:605:in `block in default_terminator'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:199:in `block in halting'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `block in invoke_before'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `each'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:513:in `invoke_before'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:131:in `run_callbacks'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/reloader.rb:89:in `prepare!'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/railties-5.2.3/lib/rails/application/finisher.rb:63:in `block in <module:Finisher>'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:347:in `each'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:347:in `call'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
    from /home/norton/workspace/IotNotificationManager/config/environment.rb:5:in `<main>'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/spring-2.0.2/lib/spring/application.rb:102:in `preload'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
    from /home/norton/.rvm/gems/ruby-2.4.3/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/norton/.rvm/rubies/ruby-2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

1 个答案:

答案 0 :(得分:0)

尝试一下:

删除名为 Gemfile.lock 的文件(在gemfile下面)

再次运行bundle install