'Why do I get this module error: "Can't locate Error.pm in @INC"?
I tried running:
perl -e "use Error;"
from cmd in windows 7. (active perl 5.12 installed on system) and I am getting the error
Can't locate Error.pm in @INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib )
I manually searched and found Error.pm in C:/Perl64/lib/CPANPLUS.
Does anyone have an idea what could be going on here?
Solution 1:[1]
You have to install the module Error that can be found on CPAN. But be aware of this warning:
Using the "Error" module is no longer recommended due to the black-magical nature of its syntactic sugar, which often tends to break. Its maintainers have stopped actively writing code that uses it, and discourage people from doing so. See the "SEE ALSO" section below for better recommendations.
Solution 2:[2]
lib/CPANPLUS/Error.pm is a core "CPANPLUS::Error" module. It is used by CPANPLUS. If you want to use non-core "Error" module, you need to install it. Do "ppm install Error". Also, you can use similar modules Try::Tiny and TryCatch. They are non-core too, so you also would need to install them.
Solution 3:[3]
I'm on CentOS 7.3, and I have git-1.8.3.1-23 and perl-Error-0.17014-1 rpm packages installed and still got this error. I didn't want to mess with installing perl modules via CPAN. I figured out the path where perl-Error is installed (rpm -ql perl-Error) and am now running git commands like so:
PERL5LIB="/usr/lib/perl5/vendor_perl/5.8.8" git add -p someFile.sh
This works fine for me. Note that the path may be different for you.
Solution 4:[4]
On Centos 8, you can installing perl-Error to get this module:
sudo dnf install perl-Error
Solution 5:[5]
you could set PERL5LIB to prepend a directory to @INC
PERL5LIB="C:/Perl64/lib/CPANPLUS"
I forget how to set env variables permanently in windows (or if this is even the right syntax for the shell.)
also to see your @INC perl -V
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | daxim |
| Solution 2 | Alexandr Ciornii |
| Solution 3 | fholzer |
| Solution 4 | qwertzguy |
| Solution 5 | xenoterracide |
