简体   繁体   English

cpan App::cpanminus 失败并出现多个错误:“放弃解析您的 /Users/foo/.cpan/sources/modules/02packages.details.txt.gz,错误太多”

[英]cpan App::cpanminus fails with multiple errors: "Giving up parsing your /Users/foo/.cpan/sources/modules/02packages.details.txt.gz, too many errors"

I am trying to install App::cpanminus Perl module using cpan App::cpanminus .我正在尝试使用cpan App::cpanminus安装 App::cpanminus Perl 模块。 I am getting the following errors.我收到以下错误。 How can I fix the errors and install the module?如何修复错误并安装模块?

% cpan App::cpanminus
Reading '/Users/foo/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with HTTP::Tiny:
http://mirrors.ccs.neu.edu/CPAN/modules/02packages.details.txt.gz
HTTP::Tiny failed with an internal error: Could not connect to 'mirrors.ccs.neu.edu:80': nodename nor servname provided, or not known


Trying with
    /usr/local/bin/wget -O "/Users/foo/.cpan/sources/modules/02packages.details.txt.gz.tmp73271"
to get
    http://mirrors.ccs.neu.edu/CPAN/modules/02packages.details.txt.gz
--2021-11-02 11:31:07--  http://mirrors.ccs.neu.edu/CPAN/modules/02packages.details.txt.gz
Resolving mirrors.ccs.neu.edu (mirrors.ccs.neu.edu)... failed: nodename nor servname provided, or not known.
wget: unable to resolve host address 'mirrors.ccs.neu.edu'

...
Saving to: '/Users/foo/.cpan/sources/modules/02packages.details.txt.gz.tmp73271'

/Users/foo/.cpan/source     [ <=>                                              ]  43.63K  --.-KB/s    in 0.001s  

2021-11-02 11:31:08 (34.3 MB/s) - '/Users/foo/.cpan/sources/modules/02packages.details.txt.gz.tmp73271' saved [44681]

Reading '/Users/foo/.cpan/sources/modules/02packages.details.txt.gz'
Warning: Your /Users/foo/.cpan/sources/modules/02packages.details.txt.gz does not contain a Line-Count header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
Warning: Your /Users/foo/.cpan/sources/modules/02packages.details.txt.gz does not contain a Last-Updated header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
Could not split line[""]
Could not split line[""]
.Could not split line["    !function(f,b,e,v,n,t,s)"]
Could not split line["    {if(f.fbq)return;n=f.fbq=function(){n.callMethod?"]
Giving up parsing your /Users/foo/.cpan/sources/modules/02packages.details.txt.gz, too many errors

Looks to me like there were attempt to download the file using multiple methods, and all of them failed, leaving you with no file or an empty file.在我看来,尝试使用多种方法下载文件,但都失败了,让您没有文件或文件为空。

This points to a networking issue.这表明存在网络问题。 You'll need to fix your network issues to continue.您需要修复网络问题才能继续。 Perhaps you need to use a different mirror, or perhaps the downloaders need to be directed to use a proxy.也许您需要使用不同的镜像,或者可能需要指导下载者使用代理。

Note that you can delete the file, forcing another attempt to download it.请注意,您可以删除该文件,从而强制再次尝试下载它。


Update: I checked the validity of the URL your cpan is configured to use ( http://mirrors.ccs.neu.edu/CPAN ), and it's bad.更新:我检查了您的cpan配置使用的 URL 的有效性( http://mirrors.ccs.neu.edu/CPAN ),这很糟糕。 The name mirrors.ccs.neu.edu can't be resolved.名称mirrors.ccs.neu.edu无法解析。 As such, you need to configure cpan to use a different mirror.因此,您需要配置cpan以使用不同的镜像。

To tell cpan to use something else, run cpan .要告诉cpan使用其他东西,请运行cpan From within, use either o conf init urllist or o conf urllist http://www.cpan.org/ .从内部,使用o conf init urllisto conf urllist http://www.cpan.org/ Don't forget to save the setting using o conf commit before exiting ( quit ).不要忘记在退出之前使用o conf commit保存设置( quit )。

You could also use something like你也可以使用类似的东西

printf '%s\n%s\n' 'o conf urllist http://www.cpan.org/' 'o conf commit' | cpan

Update: Even though the answer below worked for me, I later learned of a better answer, plus the correct explanation of the root cause.更新:尽管下面的答案对我有用,但我后来了解到一个更好的答案,以及对根本原因的正确解释。 Please see the answer above from ikegami for the preferred and accepted method.请参阅上面来自池上的答案,了解首选和接受的方法。 Keeping the answer below for historical purposes, and because it also works.出于历史目的保留以下答案,因为它也有效。

The cause of the error is that file 02packages.details.txt.gz , and/or possibly other files are corrupted. 错误的原因是文件 02packages.details.txt.gz和/或可能的其他文件已损坏。 Move .cpan directory to a new location and rerun the command again..cpan目录移动到新位置并再次重新运行该命令。 It should now work.它现在应该可以工作了。

cd && mv .cpan .cpan-bak
cpan App::cpanminus

Prints:印刷:

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] 
...
  MIYAGAWA/App-cpanminus-1.7044.tar.gz
  /usr/bin/make install  -- OK

This confirmed working solution was copied from this answer by Arjuna Del Toso to similar question , to whom all the credit should go.这个确认的工作解决方案是从Arjuna Del Toso 的这个答案复制到类似问题的,所有的功劳都应该归于谁。 I am posting it here so that a search for this error message leads to this page with a working solution.我将它张贴在这里,以便搜索此错误消息会导致此页面具有有效的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM