James
James

Reputation: 117

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?

Upvotes: 5

Views: 22296

Answers (2)

rogerdpack
rogerdpack

Reputation: 66911

For me this meant I had an earlier aborted run of cpan's installation.

fix: remove ~/.cpan and ~/perl5 dirs, and remove anything about them from .bashrc, and do it again...

Upvotes: 0

darch
darch

Reputation: 4311

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.

Upvotes: 20

Related Questions