Search code examples
perlcpan

Why Do I get Can't locate Module/Find.pm in @INC


Ok so I've been trying to get this source up to work for my game but after I install all of the modules I receive this error in my terminal.

PS C:\Users\NAME\desktop\Luna> perl Run.pm
Can't locate Module/Find.pm in @INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib .) at Run.pm line 8.
BEGIN failed--compilation aborted at Run.pm line 8.

I don't understand why i'm getting it

and here is line 8

use Module::Find;

Does anyone know why this is happening?


Solution

  • This points out why it is important to understand a bit about using the computer one chooses to use. In this case, you have two Perl installations. In one, perl.exe lives in c:\perl64\bin (I am assuming that is ActivePerl). The other perl.exe lives in c:\strawberry\perl\bin. It seems you managed to install (possibly via a cpanm that only appears in c:\strawberry\perl\bin) Module::Find for Strawberry Perl.

    Apparently, in your environment, c:\perl64\bin comes before c:\strawberry\perl\bin. Therefore, your perl Run.pm, you invoke the perl in that directory. Each installation has a number of default places where it looks for modules (you can list those using perl -V). ActiveState'sperl.exe` will not be looking for modules in Strawberry Perl's directories.

    It is possible to have multiple Perl installations co-exist peacefully in Windows, but it becomes more complicated than necessary due to the shortcomings of tools that generate batch files that invoke installed Perl scripts. These tools just invoke perl as opposed to putting the full path to the perl.exe that was used to create the batch file.

    Until that becomes the default, the easiest way I have found of dealing with this situation is designating one Perl distro as my default, and using a number of batch file and symbolic link tricks to switch between that and others.