andk / cpanpm

CPAN.pm
87 stars 79 forks source link

Can't locate local/lib.pm in @INC : Installation of `App::cpanminus` fails on Windows 11, WSL with Ubuntu 20.04 #156

Open hakonhagland opened 2 years ago

hakonhagland commented 2 years ago

I am on Windows 11 in WSL terminal for Ubuntu 20.04.

$ perl --version | head -1
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-gnu-thread-multi

$ which perl
/usr/bin/perl

$ cpan App::cpanminus
Loading internal logger. Log::Log4perl recommended for better logging

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes]
Use of uninitialized value $what in concatenation (.) or string at /usr/share/perl/5.30/App/Cpan.pm line 679, <STDIN> line 1.

Warning: You do not have write permission for Perl library directories.

To install modules, you need to configure a local Perl library directory or
escalate your privileges.  CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available).  You may also
resolve this problem manually if you need to customize your setup.

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib]
Attempting to create directory /home/hakon/perl5
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for local::lib
Writing MYMETA.yml and MYMETA.json
Can't locate local/lib.pm in @INC (you may need to install the local::lib module) (@INC contains: /home/hakon/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl/5.30/CPAN/FirstTime.pm line 1357.
hakonhagland commented 2 years ago

Workaround: Install local::lib manually first:

wget https://cpan.metacpan.org/authors/id/H/HA/HAARG/local-lib-2.000028.tar.gz
tar zxvf local-lib-2.000028.tar.gz
cd local-lib-2.000028
perl Makefile.PL --bootstrap
make
make test
make install
perl -I$HOME/perl5/lib/perl5 -Mlocal::lib >> ~/.bashrc
source ~/.bashrc
hakonhagland commented 2 years ago

I think the problem was that make was not installed. At least that should make make fail with "Command not found" when installing local::lib?