1

I'm using CentOS 6.6 and install Perl, cpanm, and Perlbrew to it. But when I try to run Perlbrew (to install specific Perl version) or cpanm with sudoer permission, a "not found error" comes out:

sudo: cpanm: command not found
sudo: perlbrew: command not found

It's OK when running without sudoers permission or root permission. How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

2 Answers2

1

Use the --sudo option for cpanm

cpanm --sudo some::package

or run sudo with -E to preserve environment, and pass PATH

sudo -E PATH="$PATH" cpanm some::package

This works if you have a perlbrew-ed Perl

-1

Possible duplicate of Command mvn and error message “command not found” when using sudo (cross-site).

sudo does not invoke a login shell, so it doesn't install any of your (modified) PATH's. Add the path of rakudobrew/bin to the secure_path in /etc/sudoers.

Community
  • 1
  • 1
elcaro
  • 2,227
  • 13
  • 15