LoginSignup
0
0

More than 1 year has passed since last update.

! Unable to load application: Zeitwerk::NameError: expected file /var/www/~ to define constant Users::SessionsController, but didn'tの解決方法

Last updated at Posted at 2021-12-13

背景

pumaを起動させると

! Unable to load application: Zeitwerk::NameError: expected file /var/www/~ to define constant Users::SessionsController, but didn't

のようなエラーが発生しました。

解決方法

エラーの翻訳としては「アプリケーションが読み込めません: Zeitwerk::名前エラー: SessionControlerのUser定数を定義するための予期されたファイル/var/www/~ ,しかし読み込めなかった。」

Zeitwerkというのは調べてみるとrails6から導入された自動でファイルを読み込んでくれものです。それがうまく動作していなくてアプリケーションを読み込めませんということです。

(参考)
https://zenn.dev/murakamiiii/articles/893d83626c9f15

解決の仕方を調べてみると、stack overflowで以下の記事が見つかり、これを参考に

config.autoloader = :classic

をconfig/application.rbに記述し、

bundle exec pumactl start

を出力すると無事、pumaを起動することができました。

(参考2)
https://stackoverflow.com/questions/57277351/rails-6-zeitwerknameerror-doesnt-load-class-from-module

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0