Ruby on rails 如何避免bootsnap和railties导致此错误?
----更新 我已经在另一个目录中克隆了repo,并再次抛出了all进程,不过这次我注意到问题只有在使用以下命令后才会出现:Ruby on rails 如何避免bootsnap和railties导致此错误?,ruby-on-rails,deployment,rubygems,Ruby On Rails,Deployment,Rubygems,----更新 我已经在另一个目录中克隆了repo,并再次抛出了all进程,不过这次我注意到问题只有在使用以下命令后才会出现: bundle install --deployment --without development test 如果我只使用bundle安装,我就可以rails c毫无问题 为什么会这样?使用这些标志是否重要?我这么做只是因为 ----更新 我正试图在Ubuntu上部署ruby应用程序。我曾经通过rails c在错误的位置正确运行过一次相同的回购。 然后我在正确的位置(v
bundle install --deployment --without development test
如果我只使用bundle安装
,我就可以rails c
毫无问题
为什么会这样?使用这些标志是否重要?我这么做只是因为
----更新
我正试图在Ubuntu上部署ruby应用程序。我曾经通过rails c
在错误的位置正确运行过一次相同的回购。
然后我在正确的位置(var/www/app/code
)执行了所有相同的步骤,但当我运行rails c
时,我遇到了以下问题:
user@cardano-db-sync:/var/www/swan/code$ rails c
Traceback (most recent call last):
80: from bin/rails:9:in `<main>'
79: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
78: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
77: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
76: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
75: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
74: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/commands.rb:18:in `<main>'
73: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/command.rb:50:in `invoke'
72: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/command/base.rb:69:in `perform'
71: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
72: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/command/base.rb:69:in `perform' [0/1955]
71: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
70: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
69: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
68: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/commands/console/console_command.rb:101:in `perform'
67: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
66: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/command/actions.rb:28:in `require_environment!'
65: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/application.rb:360:in `require_environment!'
64: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
63: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
62: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
61: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
60: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
59: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
58: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
57: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
56: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
55: from /var/www/swan/code/config/environment.rb:5:in `<main>'
54: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/application.rb:384:in `initialize!'
53: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/initializable.rb:60:in `run_initializers'
52: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
51: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
50: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
49: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:347:in `call'
48: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:347:in `each'
47: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
46: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
45: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:415:in `call'
44: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/initializable.rb:50:in `tsort_each_child'
43: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/initializable.rb:50:in `each'
42: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
41: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
40: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
39: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
38: from /home/user/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
37: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/initializable.rb:61:in `block in run_initializers'
36: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/initializable.rb:32:in `run'
35: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/initializable.rb:32:in `instance_exec'
34: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/engine.rb:570:in `block in <class:Engine>'
33: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/engine.rb:570:in `each'
32: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/engine.rb:571:in `block (2 levels) in <class:Engine>'
31: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
30: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
29: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
28: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
27: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
26: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
25: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
24: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
23: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
22: from /var/www/swan/code/config/environments/development.rb:1:in `<main>'
21: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/railtie.rb:234:in `configure'
20: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.1/lib/rails/railtie.rb:234:in `instance_eval'
19: from /var/www/swan/code/config/environments/development.rb:51:in `block in <main>'
18: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
17: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
16: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
15: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
14: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
13: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
12: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
11: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
10: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
9: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/evented_file_update_checker.rb:6:in `<main>'
8: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
7: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
6: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
5: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
4: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
3: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
1: from /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': cannot load such file -- listen (LoadError)
你的错误在最后一行 /var/www/swan/code/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.7.3/lib/bootsnap/load\u path\u cache/core\u ext/kernel\u require.rb:23:“require”中:无法加载此类文件--侦听(LoadError)
bundle安装—部署—无需开发测试
command仅安装生产和通用gems。不安装开发或测试gems。Rails读取设置环境的环境变量<代码>RAILS_ENV变量,如果未设置RAILS默认接受开发。bundler尝试加载所有gems+开发组gems。但是bundle安装--部署--没有开发测试
命令,只安装生产和通用gems。所以未安装listen gem,因为listen gem位于开发组中RAILS\u ENV=production bin/RAILS c
命令未抛出错误,因为未尝试加载开发gems。如果要将生产模式运行到RAILS,首先必须添加RAILS\u ENV=production
环境变量或在命令之前。您的错误似乎与config/environments/development.rb:51
内容有关?config.file\u watcher=ActiveSupport::EventFileUpdateChecker
抱歉,我最近看到了错误。。。
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.3'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# 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'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'
gem 'jsonapi-serializer'
gem 'jwt'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'seed_dump'
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'pry'
end
group :development do
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 'rails-erd'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]