2024/02/13 22:13:39

MojoMojo: トラブルシューティング

このページは Troubleshooting の和訳です。

はじめにやること

はじめに以下のことをやりましょう:

  • 最新版のコード - git pull
  • 最新の CPANモジュール (古いモジュールは良くわからない障害を起こしがち) - perl Makefile.PL; make

Q: make test すると "no schema has been selected" エラーがでる

DBIx::Class::Schema::deploy(): DBI Exception: DBD::Pg::db
do failed: ERROR:  no schema has been selected to create in

A. This happens if you use PostgreSQL and there is no public schema in the search_path. To fix that, make sure your username's rolconfig doesn't exclude public from the search_path:

select rolname,rolconfig from pg_roles;

Q: make test すると、jpeg がサポートされていないとエラーがでる

format 'jpeg' not supported - formats bmp, ico, pnm, raw, sgi, tga available for reading
at /root/.cpan/build/MojoMojo-0.999027-NEjeWE/lib/MojoMojo/Schema/Result/Photo.pm line 177.

A: インストールされている Imager が jpeg 画像をサポートできていないので、 libjpeg / libpng とそれらの dev パッケージをインストールしなおして、改めて CPAN から Imager をインストールしてみてください。 force install Imager

Q: script/mojomojo\*.pl を実行すると DBIC のインスタンスが生成できないとエラーがでる

Couldn't instantiate component "MojoMojo::Model::DBIC", "Either ->config->{connect_info}
must be defined for MojoMojo::Model::DBIC or MojoMojo::Schema must have connect info defined on it.

A: Makefile.PL をアプリケーションの root ディレクトリで行っているか確認してみてください。もしくは、mojomojo_*.pl を絶対パスで実行しないでください。まず、MojoMojo の root に cd して、そこで Makefile.PL してください。

Q: データベースにアクセスするパスワードを正常に戻すにはどうすれば良いですか?

A: データベースのパスワードを書き換えれば良い。

perl -Ilib -MMojoMojo -le'MojoMojo->model("DBIC::Person")->find({login=>"admin"})->update({pass=>"wonky"});'

Q: "Invalid date format" というメッセージは何?

 Couldn't render template "undef error - Error while inflating 0 for created on
 MojoMojo::Schema::Result::Content: Invalid date format: 0 at 
 /usr/local/lib/perl/5.10.0/Template/Service.pm line 91

A: おそらく、DBIx::Class::DateTime::Epoch のバージョンが 0.04 より古いためでしょう。

Q: default store type について、次のようなエラーが出ました

You must configure a default store type unless you use exactly one store plugin. 
at /usr/local/share/perl/5.10.0/Catalyst/Plugin/Authentication.pm line 203

A: Catalyst::Plugin::AuthenticationCatalyst::Plugin::Cache をアップデートしてください。

Q: MojoMojo をアップデートしたら、無事動いたけど、どのページも見えない

A: 'Site Settings' 項目の main_formatter1 を明示しなければいけなくなりました。

Q: Invalid Args('') - t/01app.t テストがこける

次のようなエラー:

Failed test 'use Catalyst::Test;'
#   at t/01app.t line 7.
#   Tried to use 'Catalyst::Test'.
    Error:  Could not load class (MojoMojo) because : 
    Invalid Args('') for action attachment/defaultaction 
    (use 'Args' or 'Args(<number>)'Compilation failed
    in require at /usr/local/lib/perl/5.10.0/Class/MOP.pm line 135.

A: Your version of Catalyst is too smart ;)

What was once interpreted as Args(0) when writing Args('') now2 throws an error with Catalyst. The MojoMojo code base was patched in version 0.999030. You can update you version of MojoMojo or directly patch with

sub defaultaction : PathPart('') Chained('attachment') Args(0) {
    my ( $self, $c ) = @_;
    $c->forward('view');
}

in your Attachment Controller.


  1. In other words for DB schema freaks, the table preference needs a prefkey of main_formatter with a value of either MojoMojo::Formatter::Textile or MojoMojo::Formatter::Markdown. ↩

  2. Catalyst::Runtime version 5.8004 or there abouts. ↩

サイト内検索