Search code examples
perlcpan

Perl Compilation Error: "Can't locate local/lib.pm"


As a Perl rookie, I have made a rookie mistake.

I was working on a project that required an HTML parser so I thought I'd install Perl's HTML::TreeBuilder::XPath module, so I dove into cpan and perlbrew without a full understanding of how they work. I created a local library, but would like to return everything back to default. However, I get this error every time I open a terminal window (twice, for some reason):

Can't locate local/lib.pm in @INC (@INC contains: 
/Users/James/perl5/lib/perl5
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
/Network/Library/Perl/5.12/darwin-thread-multi-2level 
/Network/Library/Perl/5.12 
/Library/Perl/Updates/5.12.4/darwin-thread-multi-2level 
/Library/Perl/Updates/5.12.4
/System/Library/Perl/5.12/darwin-thread-multi-2level
/System/Library/Perl/5.12
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.12 .).
BEGIN failed--compilation aborted.

I've seen the similar StackOverflow question here but I do not have apt-get installed.

How can I reset my machine so that this error no longer appears and it uses the default library?


Solution

  • The local::lib installation instructions tell you to add a line to your .bashrc or .bash_profile. From your error, it looks like the line

    eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
    

    is still present. Look for it and remove it.