Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is plenv install-cpanm installing to the wrong location?

Tags:

perl

cpanm

plenv

Something wacky happened with my plenv setup and I haven't gotten my head around it.

plenv install-cpanm
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100  297k  100  297k    0     0  1571k      0 --:--:-- --:--:-- --:--:-- 1567k
!
! Can't write to /Library/Perl/5.18 and /usr/local/bin: Installing modules to /Users/olaf/perl5
! To turn off this warning, you have to do one of the following:
!   - run me as a root or with --sudo option (to install to /Library/Perl/5.18 and /usr/local/bin)
!   - Configure local::lib in your existing shell to set PERL_MM_OPT etc.
!   - Install local::lib by running the following commands
!
!         cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
!
App::cpanminus is up to date. (1.7042)

$ plenv which cpanm
plenv: cpanm: command not found

$ find /Users/olaf | grep bin/cpanm
/Users/olaf/.cpanm/work/1482416411.97013/App-cpanminus-1.7042/bin/cpanm
/Users/olaf/.cpanm/work/1482416863.23085/App-cpanminus-1.7042/bin/cpanm
/Users/olaf/perl5/bin/cpanm

$ find /Users/olaf/.plenv | grep cpanm
/Users/olaf/.plenv/libexec/plenv-install-cpanm
/Users/olaf/.plenv/plenv.d/rehash/rehash_cpanm.bash

I would expect cpanm to get installed somewhere inside of ~/.plenv, but that's just not happening. I'm guessing something in my dot files/shell setup/$ENV is messed up?

This is what my $ENV looks like:

env | grep PLENV
PLENV_SHELL=bash

Also, the beginning of my PATH is:

PATH=/Users/olaf/.plenv/shims:/Users/olaf/.plenv/bin

like image 869
oalders Avatar asked Oct 30 '22 15:10

oalders


1 Answers

I got this sorted with some help from Tatsuhiko Miyagawa. It turns out that I had switched to the system Perl via plenv and had expected it to handle module installs in the same way that it works for Perls which plenv installs for you. The solution was just to choose a version of Perl which I had installed earlier via plenv (plenv local 5.24.0) and then to plenv install-cpanm. Tatsuhiko Miyagawa also pointed out that I'll need to install-cpanm for each version of Perl that I have installed.

like image 125
oalders Avatar answered Nov 15 '22 07:11

oalders