模块安装成功但找不到

Modules install successfully but cannot be found

我想知道为什么即使安装了依赖项我也会得到 "Installing the dependencies failed: Module 'Module::Name' is not installed"。我正在使用 perlbrewcpanm。这是我尝试安装的许多模块所发生情况的示例:

  1. 我尝试安装 URI::ws 如下
hamid@caspian:~$ /home/hamid/perl5/perlbrew/bin/cpanm --installdeps URI::ws
--> Working on URI::ws
Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/URI-ws-0.03.tar.gz ... OK
Configuring URI-ws-0.03 ... OK
==> Found dependencies: URI
--> Working on URI
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/URI-1.67.tar.gz ... OK
Configuring URI-1.67 ... OK
Building and testing URI-1.67 ... OK
Successfully installed URI-1.67
! Installing the dependencies failed: Module 'URI' is not installed
! Bailing out the installation for URI-ws-0.03.
1 distribution installed
  1. 它告诉我 URI 没有安装。所以我安装 URI 如下:
hamid@caspian:~$ /home/hamid/perl5/perlbrew/bin/cpanm URI
--> Working on URI
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/URI-1.67.tar.gz ... OK
Configuring URI-1.67 ... OK
Building and testing URI-1.67 ... OK
Successfully installed URI-1.67
1 distribution installed
  1. 我回到最初想要的 URI::ws,这是我得到的:
hamid@caspian:~$ /home/hamid/perl5/perlbrew/bin/cpanm URI::ws
--> Working on URI::ws
Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/URI-ws-0.03.tar.gz ... OK
Configuring URI-ws-0.03 ... OK
==> Found dependencies: URI
--> Working on URI
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/URI-1.67.tar.gz ... OK
Configuring URI-1.67 ... OK
Building and testing URI-1.67 ... OK
Successfully installed URI-1.67
! Installing the dependencies failed: Module 'URI' is not installed
! Bailing out the installation for URI-ws-0.03.
1 distribution installed

谁能告诉我为什么会这样,我能做些什么来阻止它?如果我遗漏了您需要的更多信息,请告诉我。

谢谢

感谢https://whosebug.com/users/2019415/g-cito

hamid@caspian:~$ PERL_MM_OPT=""; PERL_MB_OPT="";

完成任务:)

local::lib 搞砸了。 URI.pm 已安装但不在 perlbrew 目录下。

With perlbrew you can install a perlbrew specific cpanm 这有助于使用 perlbrew 工具安装到 installed/managed 的各种 perls/。我发现这很管用。

但是 perlbrew 如果您混入自己的 local::lib and set related environment variables like PERL5LIB, PERL_MM_OPT, PERL_MB_OPT etc. (see for example the post by @cjm in perlbrew and local::lib at the same time?), 可能会感到困惑。这些环境变量中的一些可以与 perlbrew 自己的环境交互和干扰,因此通常最好避免混合它们或简单地让 perlbrew 使用这些变量自己的版本来管理环境。

当然可以使用 local::lib 环境 "inside" 带有 lib 命令的 perlbrew)并做非常复杂的事情来测试不同的 perl 版本,运送一个有要求的应用程序(c.f. Carton)。在我自己的环境中,我能够管理系统 perl;用户安装了使用系统 perl 的 local::lib;以及大量 perlbrew perls,所有这些都明智地使用了环境变量(幸运的是在版本之间迁移时的临时设置)。

这种设置很快就会变得复杂,而且很难复制。 perlbrew 的最大优点之一是您可以轻松地在多台机器上设置匹配的 perl 环境;或同一台机器上的不同 perl 环境。