Can’t locate CPAN.pm in @INC

Had a strange one while installing my new work laptop. I was migrating from one system to another, so I did a clean install of Fedora 21 and copied my data over. After that I could no longer open cpan, getting the error:

$ echo o conf | perl -MCPAN -e shell
Can't locate CPAN.pm in @INC (you may need to install the CPAN module)

Followed by a list of paths that did not even exist.

I re-installed again and confirmed that perl and cpan were working fine. Then I restored my data, only to find that the same thing happened again. That ruled out a system issue and then I finally did a

which perl
which cpan

Only to find out that they were both pointing to binaries in my home directory. At some stage I must have made a copy of perl and cpan to my ~/bin/ instead of making a symlink. I confirmed that there was a version of cpan in /bin/cpan, and then I deleted the old version from ~/bin/cpan

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published.