Home > Enterprise >  cpan App::cpanminus fails with multiple errors: "Giving up parsing your /Users/foo/.cpan/source
cpan App::cpanminus fails with multiple errors: "Giving up parsing your /Users/foo/.cpan/source

Time:11-03

I am trying to install App::cpanminus Perl module using cpan App::cpanminus. 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

CodePudding user response:

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. The name mirrors.ccs.neu.edu can't be resolved. As such, you need to configure cpan to use a different mirror.

To tell cpan to use something else, run cpan. From within, use either o conf init urllist or o conf urllist http://www.cpan.org/. Don't forget to save the setting using o conf commit before exiting (quit).

You could also use something like

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

CodePudding user response:

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. Move .cpan directory to a new location and rerun the command again. 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. I am posting it here so that a search for this error message leads to this page with a working solution.

  • Related