cpan App::cpanminus 失败并出现多个错误:"Giving up parsing your /Users/foo/.cpan/sources/modules/02packages.details.txt.gz, too many errors"
cpan App::cpanminus fails with multiple errors: "Giving up parsing your /Users/foo/.cpan/sources/modules/02packages.details.txt.gz, too many errors"
我正在尝试使用 cpan App::cpanminus
安装 App::cpanminus Perl 模块。我收到以下错误。如何修复错误并安装模块?
% 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
更新:尽管下面的答案对我有用,但我后来了解到更好的答案,以及对根本原因的正确解释。请参阅上面 ikegami 的答案,了解首选和接受的方法。出于历史目的保留下面的答案,因为它也有效。
错误的原因是文件02packages.details.txt.gz
,and/or可能其他文件已损坏。移动.cpan
目录到新目录位置并再次重新运行命令。它现在应该可以工作了。
cd && mv .cpan .cpan-bak
cpan App::cpanminus
打印:
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 answer by Arjuna Del Toso to similar question 复制的,所有功劳都应归功于他。我将它张贴在这里,以便搜索此错误消息会导致此页面具有有效的解决方案。
在我看来,有人尝试使用多种方法下载文件,但都失败了,没有文件或文件为空。
这表明存在网络问题。您需要解决网络问题才能继续。也许您需要使用不同的镜像,或者可能需要引导下载者使用代理。
请注意,您可以删除该文件,强制再次尝试下载它。
更新:我检查了 URL 的有效性,您的 cpan
配置为使用 (http://mirrors.ccs.neu.edu/CPAN
),它是错误的。无法解析名称 mirrors.ccs.neu.edu
。因此,您需要配置 cpan
以使用不同的镜像。
要告诉 cpan
使用其他东西,运行 cpan
。从内部,使用 o conf init urllist
或 o conf urllist http://www.cpan.org/
。不要忘记在退出前使用 o conf commit
保存设置 (quit
)。
你也可以使用像
这样的东西
printf '%s\n%s\n' 'o conf urllist http://www.cpan.org/' 'o conf commit' | cpan
我正在尝试使用 cpan App::cpanminus
安装 App::cpanminus Perl 模块。我收到以下错误。如何修复错误并安装模块?
% 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
更新:尽管下面的答案对我有用,但我后来了解到更好的答案,以及对根本原因的正确解释。请参阅上面 ikegami 的答案,了解首选和接受的方法。出于历史目的保留下面的答案,因为它也有效。
错误的原因是文件移动02packages.details.txt.gz
,and/or可能其他文件已损坏。.cpan
目录到新目录位置并再次重新运行命令。它现在应该可以工作了。
cd && mv .cpan .cpan-bak
cpan App::cpanminus
打印:
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 answer by Arjuna Del Toso to similar question 复制的,所有功劳都应归功于他。我将它张贴在这里,以便搜索此错误消息会导致此页面具有有效的解决方案。
在我看来,有人尝试使用多种方法下载文件,但都失败了,没有文件或文件为空。
这表明存在网络问题。您需要解决网络问题才能继续。也许您需要使用不同的镜像,或者可能需要引导下载者使用代理。
请注意,您可以删除该文件,强制再次尝试下载它。
更新:我检查了 URL 的有效性,您的 cpan
配置为使用 (http://mirrors.ccs.neu.edu/CPAN
),它是错误的。无法解析名称 mirrors.ccs.neu.edu
。因此,您需要配置 cpan
以使用不同的镜像。
要告诉 cpan
使用其他东西,运行 cpan
。从内部,使用 o conf init urllist
或 o conf urllist http://www.cpan.org/
。不要忘记在退出前使用 o conf commit
保存设置 (quit
)。
你也可以使用像
这样的东西printf '%s\n%s\n' 'o conf urllist http://www.cpan.org/' 'o conf commit' | cpan