Dorian
Dorian

Reputation: 9145

NameError: uninitialized constant Capistrano::Puma

I got NameError: uninitialized constant Capistrano::Puma with this Gemfile:

source "https://rubygems.org"

ruby "2.7.1"

gem "rails"
gem "pg"
gem "puma"
gem "webpacker"
gem "jbuilder"
gem "bcrypt"
gem "slim-rails"
gem "emoji_regex"
gem "dotenv-rails"

gem "bootsnap", require: false

group :development, :test do
  gem "byebug"
end

group :development do
  gem "web-console"
  gem "listen"
  gem "spring"
  gem "spring-watcher-listen"

  gem "capistrano"
  gem "capistrano-rails"
  gem "capistrano-rbenv"
  gem "capistrano3-puma", "4.0.0"
end

group :test do
  gem "capybara"
  gem "selenium-webdriver"
  gem "webdrivers"
  gem "shoulda-context"
end

and this Capfile:

require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/rails"
require "capistrano/rbenv"
require "capistrano/bundler"
require "capistrano/scm/git"
require "capistrano/puma"

install_plugin Capistrano::Puma
install_plugin Capistrano::SCM::Git

set :rbenv_type, :user
set :rbenv_ruby, "2.7.1"

Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

I thought it was spring, then bootsnap, then my environment, but I have the exact same capistrano config on other projects and they work fine.

i think i will also post an issue to the capistrano3-puma repository

Upvotes: 4

Views: 4197

Answers (2)

Muhizi
Muhizi

Reputation: 19

I had the same issue. This was because, by mistake, I had installed capistrano-puma.

To fix the issue:

sudo gem uninstall capistrano-puma

Upvotes: 1

Dorian
Dorian

Reputation: 9145

The solution was to lock the version of capistrano3-puma to 4.0.0:

gem "capistrano3-puma", "4.0.0"

because i was using puma 5 and the most recent version of capistrano3-puma was 1.2.1

see this diff:

-    capistrano3-puma (1.2.1)
-      capistrano (~> 3.0)
-      puma (>= 2.6)
+    capistrano3-puma (4.0.0)
+      capistrano (~> 3.7)
+      capistrano-bundler
+      puma (~> 4.0)

Upvotes: 5

Related Questions