Railsで突然エラーが出てくるようになってしまい、困っております。
原因が全くわかりません。
解決するにはどうしたらよいでしょうか。
PS C:\pg\rails\tool> ruby -v ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32] PS C:\pg\rails\tool> rails -v Rails 5.2.0
実行したコマンド
rails new tool git init;git add -A;git commit -m 'rails new' rails g controller clickcount index
ファイルの変更:してません。
エラー
Started GET "/clickcount/index" for 127.0.0.1 at 2018-07-07 17:07:43 +0900 AbstractController::Helpers::MissingHelperError (Missing helper file helpers/c:/pg/rails/tool/app/helpers/application_helper.rb_helper.rb): app/controllers/application_controller.rb:1:in `<top (required)>' app/controllers/clickcount_controller.rb:1:in `<top (required)>' Started GET "/clickcount/index" for 127.0.0.1 at 2018-07-07 17:10:49 +0900 AbstractController::Helpers::MissingHelperError (Missing helper file helpers/c:/pg/rails/tool/app/helpers/application_helper.rb_helper.rb): app/controllers/application_controller.rb:1:in `<top (required)>' app/controllers/clickcount_controller.rb:1:in `<top (required)>'
追記
解決策を探しまして、
- Rails: AbstractController::Helpers::MissingHelperError - Missing helper file application_helper.rb_helper.rb - Stack Overflow
- RSpecを実行するとMissing helper fileと表示される - Qiita
- schema - Strange error in rails - missing helper - Stack Overflow
- Rails アプリを動かそうとしたら「Missing helper file」というエラーが発生する件 - Corredor
いろいろ調べた結果、
結局、
解消法としては、Rails アプリのディレクトリ名を一旦違う名前に変更し、元の名前に戻してやると、なぜか解消する。
らしいのですが、
なんとかリネームして再検証しましたが、
PS C:\pg\rails> Rename-Item tool tooltmp PS C:\pg\rails> Rename-Item .\tooltmp\ tool
同じくエラーでした。
単なるリネームで解消しない場合は、例えば「xxx」にディレクトリ名を変更したら、新たに「RailsPractice」ディレクトリを作り、中身をソックリそちらに移動させたりする。結局は同じディレクトリ名で、ファイルや設定は何も変更していないのだが、これで解消する。
PS C:\pg\rails> Rename-Item tool tooltmp PS C:\pg\rails> mkdir tool ディレクトリ: C:\pg\rails Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2018/07/09 11:56 tool PS C:\pg\rails> mv .\tooltmp* tool/ PS C:\pg\rails> ls tool ディレクトリ: C:\pg\rails\tool Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2018/07/07 17:04 app d----- 2018/07/07 17:04 bin d----- 2018/07/07 17:04 config d----- 2018/07/07 17:07 db d----- 2018/07/07 17:04 lib d----- 2018/07/07 17:06 log d----- 2018/07/07 17:04 public d----- 2018/07/07 17:04 storage d----- 2018/07/07 17:04 test d----- 2018/07/07 17:07 tmp d----- 2018/07/07 17:04 vendor -a---- 2018/07/07 17:04 679 .gitignore -a---- 2018/07/07 17:04 5 .ruby-version -a---- 2018/07/07 17:04 130 config.ru -a---- 2018/07/07 17:04 1957 Gemfile -a---- 2018/07/07 17:04 5086 Gemfile.lock -a---- 2018/07/07 17:04 62 package.json -a---- 2018/07/07 17:04 227 Rakefile -a---- 2018/07/07 17:04 374 README.md PS C:\pg\rails> ls .\tooltmp\ PS C:\pg\rails>
説明通りにやったのですが、
PS C:\pg\rails\tool> cd .. PS C:\pg\rails> cd tool PS C:\pg\rails\tool> rails s => Booting Puma => Rails 5.2.0 application starting in development => Run `rails server -h` for more startup options *** SIGUSR2 not implemented, signal based restart unavailable! *** SIGUSR1 not implemented, signal based restart unavailable! *** SIGHUP not implemented, signal based logs reopening unavailable! Puma starting in single mode... * Version 3.11.4 (ruby 2.4.2-p198), codename: Love Song * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://0.0.0.0:3000 Use Ctrl-C to stop Started GET "/" for 127.0.0.1 at 2018-07-09 11:58:11 +0900 AbstractController::Helpers::MissingHelperError (Missing helper file helpers/c:/pg/rails/tool/app/helpers/application_helper.rb_helper.rb):
やはり同様のエラー。
万策尽きた感……
どうしたら良いでしょうか…。
あなたの回答
tips
プレビュー