调整 ActiveStorage 中存储的图像大小时,我在 Rails 6.1.7.10 应用程序中收到以下错误:
Gem::LoadError (can't activate mini_magick (~> 4.0), already activated mini_magick-5.0.1. Make sure all dependencies are added to Gemfile.):
[bb4eb329-e514-4da5-9ad5-7aabab3e7988]
bundler (2.5.22) lib/bundler/rubygems_integration.rb:215:in `block (2 levels) in replace_gem'
image_processing (0.11.2) lib/image_processing/mini_magick.rb:1:in `<main>'
bootsnap (1.18.4) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
bootsnap (1.18.4) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
zeitwerk (2.6.18) lib/zeitwerk/kernel.rb:34:in `require'
activestorage (6.1.7.10) lib/active_storage/transformers/image_processing_transformer.rb:29:in `const_get'
activestorage (6.1.7.10) lib/active_storage/transformers/image_processing_transformer.rb:29:in `processor'
activestorage (6.1.7.10) lib/active_storage/transformers/image_processing_transformer.rb:20:in `process'
activestorage (6.1.7.10) lib/active_storage/transformers/transformer.rb:22:in `transform'
activestorage (6.1.7.10) app/models/active_storage/variation.rb:56:in `block in transform'
activesupport (6.1.7.10) lib/active_support/notifications.rb:205:in `instrument'
activestorage (6.1.7.10) app/models/active_storage/variation.rb:55:in `transform'
activestorage (6.1.7.10) app/models/active_storage/variant_with_record.rb:35:in `block in transform_blob'
activestorage (6.1.7.10) lib/active_storage/downloader.rb:15:in `block in open'
activestorage (6.1.7.10) lib/active_storage/downloader.rb:24:in `open_tempfile'
activestorage (6.1.7.10) lib/active_storage/downloader.rb:12:in `open'
activestorage (6.1.7.10) lib/active_storage/service.rb:90:in `open'
activestorage (6.1.7.10) app/models/active_storage/blob.rb:276:in `open'
activestorage (6.1.7.10) app/models/active_storage/variant_with_record.rb:34:in `transform_blob'
activestorage (6.1.7.10) app/models/active_storage/variant_with_record.rb:16:in `process'
activestorage (6.1.7.10) app/models/active_storage/variant_with_record.rb:11:in `processed'
activestorage (6.1.7.10) app/controllers/active_storage/representations/base_controller.rb:10:in `set_representation'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:427:in `block in make_lambda'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
actionpack (6.1.7.10) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:199:in `block in halting'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:512:in `block in invoke_before'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:512:in `each'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:512:in `invoke_before'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:115:in `block in run_callbacks'
actiontext (6.1.7.10) lib/action_text/rendering.rb:20:in `with_renderer'
actiontext (6.1.7.10) lib/action_text/engine.rb:59:in `block (4 levels) in <class:Engine>'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:126:in `instance_exec'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.7.10) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.7.10) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.7.10) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.7.10) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.7.10) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.7.10) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.7.10) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.7.10) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.7.10) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.7.10) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.7.10) lib/action_view/rendering.rb:39:in `process'
actionpack (6.1.7.10) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.7.10) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.7.10) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.7.10) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.7.10) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.7.10) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.7.10) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.7.10) lib/action_dispatch/routing/route_set.rb:842:in `call'
rack (2.2.10) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.10) lib/rack/etag.rb:27:in `call'
rack (2.2.10) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.10) lib/rack/head.rb:12:in `call'
actionpack (6.1.7.10) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
actionpack (6.1.7.10) lib/action_dispatch/http/content_security_policy.rb:19:in `call'
rack (2.2.10) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.10) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/cookies.rb:697:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.7.10) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.7.10) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.1.7.10) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.7.10) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.1.7.10) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (6.1.7.10) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (6.1.7.10) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (6.1.7.10) lib/rails/rack/logger.rb:26:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.10) lib/rack/method_override.rb:24:in `call'
rack (2.2.10) lib/rack/runtime.rb:22:in `call'
activesupport (6.1.7.10) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/static.rb:24:in `call'
rack (2.2.10) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.7.10) lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
railties (6.1.7.10) lib/rails/engine.rb:539:in `call'
passenger (6.0.23) src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:107:in `process_request'
passenger (6.0.23) src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
passenger (6.0.23) src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
passenger (6.0.23) src/ruby_supportlib/phusion_passenger/request_handler.rb:419:in `block (3 levels) in start_threads'
passenger (6.0.23) src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
如果我删除
mini_magick gem
,Rails 甚至不会启动:
App XXX output: Error: The application encountered the following error: Could not find gem 'mini_magick' in locally installed gems.
App XXX output: (Bundler::GemNotFound)
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/resolver.rb:354:in `raise_not_found!'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/resolver.rb:445:in `block in prepare_dependencies'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/resolver.rb:420:in `each'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/resolver.rb:420:in `map'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/resolver.rb:420:in `prepare_dependencies'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/resolver.rb:63:in `setup_solver'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/resolver.rb:28:in `start'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/definition.rb:633:in `start_resolution'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/definition.rb:306:in `resolve'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/definition.rb:582:in `materialize'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/definition.rb:193:in `specs'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/definition.rb:260:in `specs_for'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/runtime.rb:18:in `setup'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler.rb:164:in `setup'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/setup.rb:32:in `block in <top (required)>'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/ui/shell.rb:173:in `with_level'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/ui/shell.rb:119:in `silence'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/bundler-2.5.22/lib/bundler/setup.rb:32:in `<top (required)>'
App XXX output: <internal:/home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
App XXX output: <internal:/home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:382:in `activate_gem'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:546:in `running_bundler'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/helper-scripts/rack-preloader.rb:91:in `preload_app'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:399:in `run_block_and_record_step_progress'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App XXX output: /home/my_user_name/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/passenger-6.0.23/src/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2024-11-04 13:36:56.9149 3213/Tk age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/my_user_name/my_app_name: The application encountered the following error: Could not find gem 'mini_magick' in locally installed gems.
(Bundler::GemNotFound)
Error ID: a00557d5
Error details saved to: /tmp/passenger-error-m38ZIn.html
我不明白为什么 Rails 默认值
gem 'image_processing'
不仅可以工作,而且还被添加到 Gemfile 中。
请帮忙,新图像不想调整大小...我还想添加所有错误报告,现在甚至 Stackoverflow 也说告诉我们更多信息。如果我知道更多的话我就不会在这里了
我也遇到了这个问题,但是抱怨机架版本。
我将我的乘客从 6.0.23 回滚到 6.0.17,它起作用了。
不知道如何使用最新的乘客版本解决此问题。我删除了它所抱怨的机架版本。然后我得到“机架丢失”,甚至根据 Gemfile 安装了 2.2.10 版本。 所以我怀疑,乘客 6.0.23 有问题。