简体   繁体   中英

Perl CPAN Can't locate CPAN/Author.pm... when trying to install nipe

I'm trying to install "nipe" on my Windows Machine but i get this error code all the time. I have installed Strawberry Perl.

This is the error code:

Can't locate CPAN/Author.pm in @INC (you may need to install the CPAN::Author module) (@INC contains: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/share/perl5/core_perl/CPAN.pm line 19.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/CPAN.pm line 19.
Compilation failed in require at /usr/share/perl5/core_perl/App/Cpan.pm line 290.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/App/Cpan.pm line 290.
Compilation failed in require at /c/Strawberry/perl/bin/cpan line 7.
BEGIN failed--compilation aborted at /c/Strawberry/perl/bin/cpan line 7.

While you may have Strawberry Perl installed, that's not the perl you are using. C:\Strawberry\perl\bin\cpan uses the first perl in your PATH , which isn't your installation of Strawberry Perl. It appears that you are using some unix emulation (Cygwin? MSYS?) and using the perl from that emulation.

To use your Strawberry Perl build of perl , you could adjust your PATH so that SP comes before whatever perl you ended up using, or you could use

C:\Strawberry\perl\bin\perl C:\Strawberry\perl\bin\cpan Try::Tiny Config::Simple JSON

or

C:\Strawberry\perl\bin\perl -MCPAN -e"install @ARGV" Try::Tiny Config::Simple JSON

in lieu of

cpan Try::Tiny Config::Simple JSON

Similarly, if you don't adjust your path, you'll need to use

C:\Strawberry\perl\bin\perl nipe.pl ...

in lieu of

perl nipe.pl ...

If your are using windows and a bash then try to it with cmd or powershell after you applied the changes from @ikegami. Took me some time to figure out, that it had no effect to change the paths for this terminal, as it still took the paths from /usr/ /perl5/

I tried to do all of the other answers, but it didn't work. Instead it appeared that it doesn't work because I tried to run it from unix shell script (sh in powershell or git bash). After moving it from.sh to.ps1 and running non-unix way it works perfectly.

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