miyagawa / cpanminus

cpanminus - get, unpack, build and install modules from CPAN
http://cpanmin.us
746 stars 213 forks source link

Installing cpanm fails on Windows 11: make (e=2): The system cannot find the file specified. #652

Closed hakonhagland closed 1 year ago

hakonhagland commented 1 year ago

I am trying to install cpanm on Windows 11 (see https://github.com/Perl/perl5/issues/20395 for information of how I installed perl):

>cd c:\Users\hakon\perl\test\cpan_cpanm 
# delete .cpan folder
>rmdir /S/Q c:\Users\hakon\.cpan
>where perl
C:\perl-debug\bin\perl.exe
>perl --version
This is perl 5, version 37, subversion 5 (v5.37.5 (v5.37.4-121-g4e362c6516)) built for MSWin32-x64-multi-thread
[...]
>where cpan
C:\perl-debug\bin\cpan.bat

>powershell "cpan App::cpanminus 2>&1 | tee cpan.log"
[...]
Running make for M/MI/MIYAGAWA/App-cpanminus-1.7046.tar.gz
cp lib/App/cpanminus.pm blib\lib\App\cpanminus.pm
cp lib/App/cpanminus/fatscript.pm blib\lib\App\cpanminus\fatscript.pm
"C:\perl-debug\bin\perl.exe" -MExtUtils::Command -e cp -- bin/cpanm blib\script\cpanm
pl2bat.bat blib\script\cpanm
cpan : process_begin: CreateProcess(NULL, pl2bat.bat blib\script\cpanm, ...) failed.
At line:1 char:1
+ cpan App::cpanminus 2>&1 | tee cpan.log
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (process_begin: ...m, ...) failed.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

make (e=2): The system cannot find the file specified.
gmake.EXE: *** [makefile:456: blib\script\cpanm] Error 2
  MIYAGAWA/App-cpanminus-1.7046.tar.gz
  C:\Winlibs64-Gcc12-msvcrt\mingw64\bin\gmake.EXE -- NOT OK

Here is the complete log file for the last command: cpan.log

hakonhagland commented 1 year ago

The system cannot find the file specified

This issue has been resolved now. The reason why pl2bat.bat was not present, was that I had run gmake install without specifying INST_TOP. This caused the default value to be used (C:\perl) instead of the value I specified when running gmake all. See https://github.com/Perl/perl5/issues/20395 for more information.