【问题标题】:How can I get App::cpanminus to work?我怎样才能让 App::cpanminus 工作?
【发布时间】:2011-04-26 16:20:42
【问题描述】:

我刚刚安装了 ubuntu 10.10 的新副本。我在brian d foy's recommended outline 之后安装了perl 5.12.2,然后通过调用curl -L http://cpanmin.us | perl5.12.2 - --sudo App::cpanminus 安装了cpanminus。

现在,cpan5.12.2 工作正常,但是每当我尝试使用 cpanm5.12.2 安装模块时,它都找不到它。例如:

$ sudo cpanm5.12.2 -v File::Copy::Recursive
You have make /usr/bin/make
You have LWP 5.837
You have /bin/tar: tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching File::Copy::Recursive on cpanmetadb ...
! Finding File::Copy::Recursive on cpanmetadb failed.
Searching File::Copy::Recursive on search.cpan.org ...
! Finding File::Copy::Recursive on search.cpan.org failed.
! Couldn't find module or a distribution File::Copy::Recursive

【问题讨论】:

  • 普通cpan能安装吗?
  • 你有代理吗? perl -wle 'use LWP::Simple; getprint "http://cpanmetadb.appspot.com/v1.0/package/File::Copy::Recursive"' 是否返回 YAML 文件?
  • @brian d foy:是的,如前所述 - cpan5.12.2 工作正常。
  • @Schwern 我确实使用代理。你的命令返回--- distfile: D/DM/DMUEY/File-Copy-Recursive-0.38.tar.gz version: 0.38
  • 这就是它应该返回的,但是perlperl5.12.2 一样吗?使用perl5.12.2 再试一次。我怀疑代理正在干扰。您设置了 HTTP_PROXY 或 http_proxy 环境变量? LWP 应该检测到并使用它。

标签: perl ubuntu cpan


【解决方案1】:

您可以尝试使用perlbrew 来安装自定义 perl 解释器。然后您可以激活您的 5.12.2 版本,安装 cpanm(不需要 sudo)并以普通用户身份安装您的模块,例如。 "$ cpanm My::Module"

通过使用此方法,您可以获得与每个特定 perlbrew 版本相关联的自定义 cpanm 二进制文件。你必须为每个 perlbrew 版本安装 cpan 模块,但你最终不会得到像“cpanm5.12.2”这样的二进制文件,而是“cpanm”。 Perlbrew 负责设置特定于 perl 版本的路径,恕我直言,这非常方便。

【讨论】:

    【解决方案2】:

    我遇到了同样的问题。 LWP 在我的机器上使用$HTTP_PROXY 而不是$http_proxy

    如果您在没有协议的情况下为 $http_proxy 指定某些内容(在我的情况下,我缺少 http:),它会抱怨但似乎具有误导性,因为它实际上并没有找到丢失的包。

    【讨论】:

    • 这并没有提供问题的答案。要批评或要求作者澄清,请在他们的帖子下方发表评论 - 您可以随时评论自己的帖子,一旦您有足够的reputation,您就可以comment on any post
    • 他担心的是他无法安装模块,据我了解,问题的原因是他在代理后面。他解释说他设置了http_proxy 环境变量,我建议使用HTTP_PROXY 作为解决方案。
    • 这个解决方案对我有用。我试图安装一个包 (Dancer2) 并遇到同样的错误,但忘记导出代理设置。
    猜你喜欢
    • 2021-01-22
    • 1970-01-01
    • 2013-07-22
    • 2013-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-24
    相关资源
    最近更新 更多