简体   繁体   English

Perl CPAN 找不到 CPAN/Author.pm... 尝试安装 nipe 时

[英]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.我正在尝试在我的 Windows 机器上安装“nipe”,但我一直收到此错误代码。 I have installed Strawberry Perl.我已经安装了草莓 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.虽然您可能安装了 Strawberry Perl,但您使用的不是perl 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. C:\Strawberry\perl\bin\cpan在您的PATH中使用第一个perl ,这不是您安装的 Strawberry Perl。看来您正在使用一些 unix 仿真(Cygwin?MSYS?)并使用来自该仿真的perl .

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要使用 perl 的 Strawberry perl版本,您可以调整PATH以便 SP 出现在您最终使用的任何perl之前,或者您可以使用

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.如果您使用的是 windows 和 bash,请在应用来自@ikegami 的更改后尝试使用 cmd 或 powershell。 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/我花了一些时间才弄清楚,更改此终端的路径没有任何效果,因为它仍然采用 /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).相反,它似乎不起作用,因为我试图从 unix shell 脚本(powershell 或 git bash 中的 sh)运行它。 After moving it from.sh to.ps1 and running non-unix way it works perfectly.将其从 .sh 移动到 .ps1 并运行非 unix 方式后,它可以完美运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM