【问题标题】:git checkout --patch, but failed, Can't locate Git.pm in @INCgit checkout --patch,但失败,在@INC 中找不到 Git.pm
【发布时间】:2015-01-26 20:43:06
【问题描述】:

当我运行 git checkout --patch origin/master file.java 时,我看到:

Can't locate Git.pm in @INC (you may need to install the Git module) 
(@INC contains: 
/usr/share/perl/5.14.2 
/usr/local/perl/lib/site_perl/5.20.0/x86_64-linux 
/usr/local/perl/lib/site_perl/5.20.0 
/usr/local/perl/lib/5.20.0/x86_64-linux /usr/local/perl/lib/5.20.0 .) 
at /usr/lib/git-core/git-add--interactive line 7.
BEGIN failed--compilation aborted at /usr/lib/git-core/git-add--interactive line 7.

我在 Ubuntu 12.04.4 LTS 上运行它。 git 的版本是 1.7.9.5。 perl 是 perl5, version 20, subversion 0 (v5.20.0) build for x86_64-linux。

【问题讨论】:

  • 应该有/usr/share/perl5/Git.pm(来自git包,用dpkg -L git | grep Git验证它的存在)和/usr/share/perl5目录应该在默认的perl5搜索路径中
  • 我已经用user3159253的方法解决了这个问题。 /usr/share/perl5/Git.m 存在,但 /usr/share/perl5 不在默认的 perl 搜索路径中(使用 perl -V)。然后我将 export PERL5LIB=/usr/share/perl5 添加到 ~/.bashrc 中。然后它运作良好。谢谢。
  • 对于那些在 OS X 上遇到这个问题的人,请查看stackoverflow.com/q/17736330/72321

标签: linux git perl cpan


【解决方案1】:

PATH 中可能缺少/usr/share/perl5/Git.pm(或类似名称,具体取决于系统)。

export PERL5LIB=/usr/share/perl5 添加到~/.bashrc 文件应该可以解决问题。

【讨论】:

    猜你喜欢
    • 2012-12-24
    • 1970-01-01
    • 2012-04-26
    • 1970-01-01
    • 2013-01-13
    • 2021-10-03
    • 1970-01-01
    • 2020-10-14
    相关资源
    最近更新 更多