简体   繁体   English

cpan 说 App::cpanminus 是最新的,但 cpanm 没有出现在 /usr/bin 中

[英]cpan says App::cpanminus is up to date but cpanm doesn't come up in /usr/bin

SHORT QUESTION简短的问题

I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus and then **sudo** /usr/bin/cpan -i App::cpanminus It said App::cpanminus is up to date.我已经使用/usr/bin/cpan -i App::cpanminus然后**sudo** /usr/bin/cpan -i App::cpanminus在 Mac mini G4 Leopard 10.5.8 和 perl-8.8.8 上安装了cpanm **sudo** /usr/bin/cpan -i App::cpanminus它说App::cpanminus is up to date. but no cpanm is available in /usr/bin or anywhere else.但在/usr/bin或其他任何地方都没有可用的 cpanm。

NOTE I've looked up the question Can't locate module in @INC but CPAN says module is up to date and some others which seemed related to my case but they didn't help.注意我已经查找了问题Can't locate module in @INC 但是 CPAN 说模块是最新的,而其他一些似乎与我的案例相关但他们没有帮助的问题。 Not much information is available in Google searches either.谷歌搜索也没有太多信息。

LONG QUESTION长问题

I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus我已经使用/usr/bin/cpan -i App::cpanminus在带有 perl-8.8.8 的 Mac mini G4 Leopard 10.5.8 上安装了cpanm

All the downloading, extracting, compiling, etc went smoothly but at the last step, before installing it as (As Far As I Can Remember / AFAICR) /usr/bin/cpanm it stopped with a permission error (AFAICR) So I've repeated the same line with sudo:所有的下载、解压、编译等都很顺利,但在最后一步,在将其安装为 (As Far As I Can Remember / AFAICR) /usr/bin/cpanm ,它因权限错误 (AFAICR) 而停止了所以我已经用 sudo 重复同一行:

~ $ sudo /usr/bin/cpan -i App::cpanminus

this time it said (again, AFAICR)这次它说(再次,AFAICR)

CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
  Database was generated on Thu, 09 Dec 2021 18:17:02 GMT
App::cpanminus is up to date.

and it didn't place the cpanm into /usr/bin or any other PATH directory.并且它没有将cpanm放入 /usr/bin 或任何其他 PATH 目录。

Note that I need to use solely perl, v5.8.8 because it is the only version compatible with some of the system level Perl applications.请注意,我只需要使用perl, v5.8.8因为它是与某些系统级 Perl 应用程序兼容的唯一版本。

When I did a search on the ~/.cpanm and the default Mac OS X Perl installation folder which is /System/Library/Perl no instance of cpanm was found.当我在~/.cpanm和默认的 Mac OS X Perl 安装文件夹(即/System/Library/Perl )上进行搜索时,没有找到cpanm的实例。 So I gather cpanm is not created at all.所以我收集cpanm根本没有创建。

I've deleted the /Users/Mac/.cpan and repeated the sudo install and it ended up with the same message above (again, AFAICR)我已经删除了/Users/Mac/.cpan并重复了sudo安装,它最终得到了上面相同的消息(再次,AFAICR)

So I got stuck in this.所以我陷入了困境。 I didn't do anything else other than deleting ~/.cpan除了删除~/.cpan我什么也没做

How to install cpan on this Mac?如何在这台 Mac 上安装cpan

Note 2 My question's title might not be best.注 2我的问题的标题可能不是最好的。 Anyone is free to edit the title or the question.任何人都可以自由编辑标题或问题。

A few things to note:需要注意的几点:

  • The cpan output should tell you where it installed things. cpan output 应该告诉你它安装在哪里。 Do you have the output?你有 output 吗? To try again, you can force install with cpan -f to see what happened.要再试一次,您可以使用cpan -f强制安装以查看发生了什么。

  • The .cpan/ directory is just a work directory for CPAN.pm. .cpan/目录只是 CPAN.pm 的工作目录。 However, you can go into its build/ directory and find the directory for the thing you are having trouble with to look at its build files.但是,您可以将 go 放入其build/目录,并找到您在查看其构建文件时遇到问题的目录。 The Makefile will have settings such as INSTALLBIN and INSTALLSITEBIN (and some others) that notes where it decided to install things. Makefile将具有诸如INSTALLBININSTALLSITEBIN (以及其他一些)之类的设置,这些设置会记录它决定安装的位置。 Apple has typically set these to whatever they wanted for you already, so it's slightly different than the default perl behavior. Apple 通常已将这些设置为他们想要的任何内容,因此它与默认的perl行为略有不同。

  • You've likely installed the cpanm script in one of perl's directories.您可能已经在 perl 的某个目录中安装了 cpanm 脚本。 Perl modules typically do not install into a common directory without you doing something special. Perl 模块通常不会安装到公共目录中,除非您做一些特别的事情。 There's likely a bin directory at the same level as the lib/ directory.可能存在与lib/目录处于同一级别的bin目录。 See where you installed the module and then look for that bin/查看您安装模块的位置,然后查找该bin/

$ cpan -D App::cpanminus
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/brian/.cpan/Metadata'
  Database was generated on Fri, 10 Dec 2021 19:29:02 GMT
App::cpanminus
-------------------------------------------------------------------------
    (no description)
    M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz
    /usr/local/perls/perl-5.34.0/lib/site_perl/5.34.0/App/cpanminus.pm
    Installed: 1.7044
    CPAN:      1.7044  up to date
    Tatsuhiko Miyagawa (MIYAGAWA)
    miyagawa@bulknews.net

$ ls -l /usr/local/perls/perl-5.34.0/bin/cpanm
-r-xr-xr-x  1 brian  wheel  302800 Jun 23 18:53 /usr/local/perls/perl-5.34.0/bin/cpanm
  • I like to leave the Perl programs in that bin directory and make links to them if I want them somewhere else in my path ( Make links to per version tools .我喜欢将 Perl 程序留在该 bin 目录中,如果我希望它们位于我的路径中的其他位置( 请链接到每个版本的工具

  • The -i switch to cpan is just extra typing. -i切换到cpan只是额外的输入。 It's implied in almost every case where you would use it.几乎在您将使用它的所有情况下都暗示了这一点。

  • You get the permission error because you are using the system Perl and installing things into the directories it set up.您收到权限错误,因为您正在使用系统 Perl 并将内容安装到它设置的目录中。 Apple is pretty good about segregating that, but I don't remember how well they were doing that back then.苹果在隔离方面做得很好,但我不记得他们当时做得有多好。 A system update (heh, in your case unlikely;) might overwrite or delete your work.系统更新(嘿,在您的情况下不太可能;)可能会覆盖或删除您的工作。 Many people use a separate, user-installed perl and pretend the system perl does not exist.许多人使用单独的、用户安装的perl并假装系统perl不存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM