Windows – Problems executing perl on git for windows bash

bashgit-bashperlwindows

The issue is that perl is installed in my system and bash can see it, however when I try to execute a perl script that includes a module, there's an error.

Can't locate Text/CSV.pm in @INC (you may need to install the
Text::CSV 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 parse_prospects.pl line 5. BEGIN
failed–compilation aborted at parse_prospects.pl line 5.

On CMD there's no such error so I wonder what I'd have to do to make them compatible. It's like perl on bash thinks it's on Linux and tries to find his packages on /usr/share

Best Answer

I was using Strawberry Perl so if you have that one and want to use Perl on MSYS2 or Git for Windows you have to specify an ENV variable called PERL5LIB with the route to your modules on Strawberry Perl or the Perl distribution you have. .

 export PERL5LIB=/c/Strawberry/perl/vendor/lib

which to be permanent on your system has to be located on your .bashrc in your home route. That way both CMD and bash will use the same modules.

Related Question