简体   繁体   中英

Can't locate local/lib.pm in @INC at /usr/share/perl/5.14/CPAN/FirstTime.pm

I am trying to use Perl the first time on my system which is Ubuntu 12.04. I have Perl v.5.14.2 installed.
I looked up how to install Perl modules , so I started as follows:

$ perl -MCPAN -e shell

The wizard started configuring the environment as can be seen here: http://pastebin.com/5hn8vkb5
Though, it stopped in the middle with the following error message:

...

Checksum for /home/john/.cpan/sources/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ok
---- Unsatisfied dependencies detected during ----
----     APEIRON/local-lib-1.008009.tar.gz    ----
    ExtUtils::MakeMaker [build_requires]
Running make test
  Make had some problems, won't test
  Delayed until after prerequisites
Running make install
  Make had some problems, won't install
  Delayed until after prerequisites

Can't locate local/lib.pm in @INC (@INC contains:
    /home/john/perl5/lib/perl5
    /etc/perl
    /usr/local/lib/perl/5.14.2
    /usr/local/share/perl/5.14.2
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.14
    /usr/share/perl/5.14
    /usr/local/lib/site_perl
    /home/john/Desktop)
at /usr/share/perl/5.14/CPAN/FirstTime.pm line 1300.

What can I do to setup the Perl environment correctly on my Ubuntu installation?


After interrupting the wizard and restarting it again, there is no error message anymore. How can I start the wizard again so I can choose here:

What approach do you want? (Choose 'local::lib', 'sudo' or 'manual') [local::lib]

You're missing local::lib , which is what you told CPAN shell to do.

You can install it like so:

sudo apt-get install liblocal-lib-perl

You might be able to start over by rm -rf -ing your ~/.cpan directory. AT YOUR OWN RISK

However, I would recommend trying cpanminus instead of the old CPAN shell .

sudo apt-get install cpanminus

The local namespace was for your own personal modules and wouldn't be found in CPAN. This is something relatively new. At many sites, you might need CPAN modules not in the current version of Perl, or you need a newer version of a particular module. However, you don't have write access to the standard location where CPAN modules are installed.

What this is doing is installing these modules under the $HOME/perl5/lib/local directory where you'll be able to access them. You would also need to setup a PERL5LIB environment variable (usually in your startup scripts), so Perl will check this directory when locating these modules.

If you have sudo privileges, use that to install CPAN modules rather than trying this. The following will install the Foo::Bar module into the standard module directory for you (and do any configuration as necessary):

$ sudo cpan install Foo::Bar

If CPAN needs to be configured, it will do that first.

There are complete directions on doing the local::lib install for modules on MetaCPAN . They're pretty clear.

Several New OS's force (like Redhat 7) force to check presence of local::lib in the perl version, actually its a good thing this enables to users to use CPAN and add,experiment and enjoy new modules to be used with the perl without waiting for sitewide installation (like a root user). By default local::lib looks for $HOME/perl5 dir where the user's local or downloaded modules are located. If you see this problem then you have to do following

  1. sudo su - whatever_user_owns_perl
  2. whatever_perl_install_path/cpan install local::lib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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