由于缺少模块而无法运行 CPAN(但它们在那里!)

由于缺少模块而无法运行 CPAN(但它们在那里!)

我的 RHEL7 Perl 安装出现了一个大问题。每当我尝试运行 时cpan,它都会出现以下错误:

[michael@xlinfp101 ~]$ sudo cpan
[sudo] password for michael:
Socket object version 2.010 does not match bootstrap parameter 2.030 at /usr/lib64/perl5/DynaLoader.pm line 213.
Compilation failed in require at /usr/share/perl5/Net/Ping.pm line 12.
BEGIN failed--compilation aborted at /usr/share/perl5/Net/Ping.pm line 12.
Compilation failed in require at /usr/share/perl5/CPAN/Mirrors.pm line 43.
BEGIN failed--compilation aborted at /usr/share/perl5/CPAN/Mirrors.pm line 43.
Compilation failed in require at /usr/share/perl5/CPAN/FirstTime.pm line 11.
BEGIN failed--compilation aborted at /usr/share/perl5/CPAN/FirstTime.pm line 11.
Compilation failed in require at /usr/share/perl5/CPAN/HandleConfig.pm line 579.

奇怪的是,perl-Socket 已安装,但没有该模块的更高版本。

[michael@xlinfp101 Socket-2.030]$ sudo yum provides perl-Socket
Loaded plugins: product-id, rhnplugin, search-disabled-repos, subscription-manager, verify
This system is receiving updates from RHN Classic or Red Hat Satellite.
perl-Socket-2.010-3.el7.x86_64 : Networking constants and support functions
Repo        : rit-2020-09-rhel-x86_64-server-7

此外,如果我尝试手动安装(make),则由于以下错误而无法安装:

[michael@xlinfp101 Socket-2.030]$ sudo perl Makefile.PL
Attempt to reload Socket.pm aborted.
Compilation failed in require at /usr/share/perl5/vendor_perl/IPC/Cmd.pm line 46.
BEGIN failed--compilation aborted at /usr/share/perl5/vendor_perl/IPC/Cmd.pm line 46.
Compilation failed in require at /usr/share/perl5/ExtUtils/CBuilder/Base.pm line 11.
BEGIN failed--compilation aborted at /usr/share/perl5/ExtUtils/CBuilder/Base.pm line 11.
Compilation failed in require at /usr/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 4.
Compilation failed in require at (eval 9) line 2.
BEGIN failed--compilation aborted at (eval 9) line 2.
Compilation failed in require at Makefile.PL line 19.

编辑 1:运行 perl shell 也不再可能......

[michael@xlinfp101 ~]$ sudo perl -MCPAN -e shell
Socket object version 2.010 does not match bootstrap parameter 2.030 at /usr/lib64/perl5/DynaLoader.pm line 213.

这种奇怪的行为首先发生在我手动删除一些模块(rm)时。我觉得我毁了一些东西...

有谁知道如何让 CPAN 重新运行的解决方案?

谢谢你!

答案1

经过几个小时的研究时间我找到了一个解决方案:

  1. 使用 YUM 卸载所有 perl 包,包括 cpan 和 cpanminus(但:记住所有包名称!)

  2. 删除主目录中的应用程序文件夹,如 .cpan 和 .cpanm

  3. yum 全部清理

  4. 从官方网站下载 perl 的源代码并构建这个(我不知道这是否会成功,但我猜,因为仅使用 yum 重新安装没有成功)

  5. 验证“perl -MCPAN -e shell”是否正常工作

  6. 使用 YUM 再次安装所有 perl 包,包括 cpan 和 cpanminus

完结。

也许有些步骤不是必需的,但我认为我分享了我所做的一切。

请记住:切勿从 PERL 系统库中删除任何内容!:P

相关内容