$shibayu36->blog;

クラスター株式会社のソフトウェアエンジニアです。エンジニアリングや読書などについて書いています。

手元とserverでのperlのversion違いで、carton installでハマった

 PrePANでcarton 1.0しようとしていたんだけど、手元ではcarton install出来るのに、サーバ側でcarton install --deploymentしようとしたらうまくいかないという状態になってしまった。いろいろ調べていたら原因が分かったのでメモ。


 結果としてcarton側が悪いのではなくて、こちら側の使い方が悪かった。手元ではperl 5.16.3を使っていたが、サーバ側は5.10.1になってしまっていたのが原因だった。
 この時、例えばJSON::PPは5.16.3ではcore moduleだが、5.10.1ではcore moduleではなく、cpanfile.snapshotの情報に齟齬が出てしまう。そのため、サーバ側では正しくインストールできなかった。

 
 試しにPrePANのrepositoryで、それぞれのversionでcarton checkしてみると以下のようになる。

$ plenv shell 5.16.3
$ carton check
cpanfile's dependencies are satisfied.
$ plenv shell 5.10.1
$ carton check
Following dependencies are not satisfied.
  CPAN::Meta is not installed. Needs 2.110420
  Perl::OSType is not installed. Needs 1
  Parse::CPAN::Meta has version 1.39. Needs 1.4401
  version has version 0.77. Needs 0.87
  parent has version 0.221. Needs 0.223
  Test::More has version 0.92. Needs 0.98
  Test::Simple has version 0.92. Needs 0.98
  IO::Uncompress::Bunzip2 has version 2.020. Needs 2.021
  ExtUtils::CBuilder has version 0.2602. Needs 0.27
  CPAN::Meta::YAML is not installed. Needs 0.003
  CPAN::Meta::Prereqs is not installed. Needs 0
  Module::Metadata is not installed. Needs 1.000002
  Test::Harness has version 3.17. Needs 3.21
  Data::Dumper has version 2.124. Needs 2.126
  JSON::PP is not installed. Needs 2
  ExtUtils::ParseXS has version 2.2002. Needs 2.21
  IO::Compress::Bzip2 has version 2.020. Needs 2.021
Run `carton install` to install them.


 使っているperlのversionが正しいことをチェックしてもらえるようにしたほうが良さそうと思って、issueにあげておくかとなったけど、warn when deploying on different perl versions/arch · Issue #98 · perl-carton/carton · GitHub にてすでにissueになっていたので、メモに留めておく。