basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
11.19k stars 437 forks source link

kamal init fails with: undefined method eager_load_namespace #1109

Open plutov opened 1 week ago

plutov commented 1 week ago

Host: mac M1

I don't have Rails on my host machine as I am not developing in Rails. Does it mean I have to install it to use Kamal?

Full error trace:

kamal init
/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal.rb:14:in `<top (required)>': undefined method `eager_load_namespace' for #<Zeitwerk::GemLoader:0x0000000100d46ce0 @initialized_at=2024-10-13 20:59:08.1509 +0200, @root_dirs={"/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib"=>Object}, @inflector=#<Zeitwerk::GemInflector:0x0000000100c46e58 @version_file="/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/version.rb", @overrides={}>, @ignored_glob_patterns=#<Set: {"/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/sshkit_with_ext.rb"}>, @ignored_paths=#<Set: {"/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/sshkit_with_ext.rb"}>, @collapse_glob_patterns=#<Set: {}>, @collapse_dirs=#<Set: {}>, @eager_load_exclusions=#<Set: {}>, @reloading_enabled=false, @on_setup_callbacks=[], @on_load_callbacks={}, @on_unload_callbacks={}, @logger=nil, @tag="kamal", @autoloads={"/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/commands.rb"=>[Kamal, :Commands], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/configuration.rb"=>[Kamal, :Configuration], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/env_file.rb"=>[Kamal, :EnvFile], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/git.rb"=>[Kamal, :Git], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/secrets.rb"=>[Kamal, :Secrets], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/tags.rb"=>[Kamal, :Tags], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/utils.rb"=>[Kamal, :Utils], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/version.rb"=>[Kamal, :VERSION], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/accessory.rb"=>[Kamal::Cli, :Accessory], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/alias"=>[Kamal::Cli, :Alias], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/app.rb"=>[Kamal::Cli, :App], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/base.rb"=>[Kamal::Cli, :Base], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/build.rb"=>[Kamal::Cli, :Build], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/healthcheck"=>[Kamal::Cli, :Healthcheck], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/lock.rb"=>[Kamal::Cli, :Lock], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/main.rb"=>[Kamal::Cli, :Main], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/proxy.rb"=>[Kamal::Cli, :Proxy], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/prune.rb"=>[Kamal::Cli, :Prune], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/registry.rb"=>[Kamal::Cli, :Registry], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/secrets.rb"=>[Kamal::Cli, :Secrets], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/server.rb"=>[Kamal::Cli, :Server], "/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/commander/specifics.rb"=>[Kamal::Commander, :Specifics]}, @autoloaded_dirs=[], @to_unload={}, @lazy_subdirs={"Kamal::Commands"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/commands"], "Kamal::Configuration"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/configuration"], "Kamal::Secrets"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/secrets"], "Kamal::Utils"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/utils"], "Kamal::Cli::Alias"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/alias"], "Kamal::Cli::App"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/app"], "Kamal::Cli::Build"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/build"], "Kamal::Cli::Healthcheck"=>["/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal/cli/healthcheck"]}, @mutex=#<Thread::Mutex:0x0000000100c477b8>, @mutex2=#<Thread::Mutex:0x0000000100c47718>, @setup=true, @eager_loaded=false, @root_file="/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib/kamal.rb", @lib="/opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/lib", @warn_on_extra_files=true> (NoMethodError)

loader.eager_load_namespace(Kamal::Cli) # We need all commands loaded.
      ^^^^^^^^^^^^^^^^^^^^^
Did you mean?  eager_load_exclusions
    from <internal:/opt/homebrew/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
    from <internal:/opt/homebrew/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
    from /opt/homebrew/lib/ruby/gems/3.2.0/gems/kamal-2.2.2/bin/kamal:6:in `<top (required)>'
    from /opt/homebrew/lib/ruby/gems/3.2.0/bin/kamal:25:in `load'
    from /opt/homebrew/lib/ruby/gems/3.2.0/bin/kamal:25:in `<main>'
s-soroosh commented 5 days ago

To use Kamal without having a Ruby environment you can use the following alias as mentioned in the installation doc.

alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest'