CPAN Perl 模块安装程序找不到 tar 文件

发布于 2025-01-07 07:48:08 字数 4610 浏览 0 评论 0原文

看来我在通过 CPAN 安装 Perl 模块时遇到配置问题,并且不知道如何纠正它:

[root@ip JESSE]# pwd
/root/.cpan/sources/authors/id/J/JE/JESSE

[root@ip JESSE]# ls -l
total 240
-rw-r--r-- 1 root root 105464 Feb 20 11:39 CHECKSUMS
-rw-r--r-- 1 root root   9223 Apr 12  2011 Locale-Maketext-Simple-0.21.tar.gz
-rw-r--r-- 1 root root 125483 Feb 20 11:39 WWW-Mechanize-1.72.tar.gz

[root@ip JESSE]# cpan -i WWW::Mechanize
CPAN: Storable loaded ok (v2.20)
Reading '/root/.cpan/Metadata'
  Database was generated on Mon, 20 Feb 2012 11:10:26 GMT
Running install for module 'WWW::Mechanize'
Running make for J/JE/JESSE/WWW-Mechanize-1.72.tar.gz
CPAN: Digest::SHA loaded ok (v5.61)
CPAN: Compress::Zlib loaded ok (v2.033)
Checksum for /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.82)
Uncompressed /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz successfully
Using Tar:/bin/tar xvf "WWW-Mechanize-1.72.tar":
Couldn't untar WWW-Mechanize-1.72.tar
CPAN: File::Temp loaded ok (v0.22)
CPAN: CPAN::Meta loaded ok (v2.112150)
Package seems to come without Makefile.PL.
  (The test -f "/root/.cpan/build/JESSE-n72IRU/Makefile.PL" returned false.)
  Writing one on our own (setting NAME to WWWMechanize)
  Had problems unarchiving. Please build manually
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install

[root@ip JESSE]# ls -l
total 240
-rw-r--r-- 1 root root 105464 Feb 20 11:39 CHECKSUMS
-rw-r--r-- 1 root root   9223 Apr 12  2011 Locale-Maketext-Simple-0.21.tar.gz
-rw-r--r-- 1 root root 125483 Feb 20 11:39 WWW-Mechanize-1.72.tar.gz

[root@ip JESSE]# which tar
/bin/tar

[root@ip JESSE]# which gzip
/bin/gzip

问题似乎在这里:

Uncompressed /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz successfully
Using Tar:/bin/tar xvf "WWW-Mechanize-1.72.tar":
Couldn't untar WWW-Mechanize-1.72.tar

tar.gz 文件确实未压缩并且可以找到在一个新目录中:

/root/.cpan/build/JESSE-KjCEMS/WWW-Mechanize-1.72.tar

如果我从 shell 内部运行相同的命令,我会得到更多信息:

cpan[1]> install WWW::Mechanize
CPAN: Storable loaded ok (v2.20)
Reading '/root/.cpan/Metadata'
  Database was generated on Mon, 20 Feb 2012 11:10:26 GMT
Running install for module 'WWW::Mechanize'
Running make for J/JE/JESSE/WWW-Mechanize-1.72.tar.gz
CPAN: Digest::SHA loaded ok (v5.61)
CPAN: Compress::Zlib loaded ok (v2.033)
Checksum for /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Use of uninitialized value $newdir in substitution (s///) at /usr/lib64/perl5/Cwd.pm line 502.
Use of uninitialized value $newdir in chdir at /usr/lib64/perl5/Cwd.pm line 510.
Use of chdir('') or chdir(undef) as chdir() is deprecated at /usr/lib64/perl5/Cwd.pm line 510.
Use of uninitialized value $newdir in pattern match (m//) at /usr/lib64/perl5/Cwd.pm line 525.
Use of uninitialized value $newdir in split at /usr/lib64/perl5/Cwd.pm line 531.
..........................................................................--DONE
DEL(1/10): /root/.cpan/build/CPAN-1.9600-jGTV10
DEL(2/10): /root/.cpan/build/File-Which-1.09-yoVWZC
DEL(3/10): /root/.cpan/build/Test-Script-1.07-aJWrXb
DEL(4/10): /root/.cpan/build/Probe-Perl-0.01-gzZ2eR
DEL(5/10): /root/.cpan/build/IPC-Run3-0.044-AP6EMp
DEL(6/10): /root/.cpan/build/Time-HiRes-1.9721-xxseE6
DEL(7/10): /root/.cpan/build/CPAN-Meta-YAML-0.003-wGtH0a
DEL(8/10): /root/.cpan/build/JSON-PP-2.27105-fvkwNa
DEL(9/10): /root/.cpan/build/Package-Constants-0.02-7Ms_OL
DEL(10/10): /root/.cpan/build/Module-Metadata-1.000004-tXKIBB
CPAN: Archive::Tar loaded ok (v1.82)
Uncompressed /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz successfully
Using Tar:/bin/tar xvf "WWW-Mechanize-1.72.tar":
Couldn't untar WWW-Mechanize-1.72.tar
CPAN: File::Temp loaded ok (v0.22)
CPAN: CPAN::Meta loaded ok (v2.112150)
Package seems to come without Makefile.PL.
  (The test -f "/root/.cpan/build/JESSE-DGrTh_/Makefile.PL" returned false.)
  Writing one on our own (setting NAME to WWWMechanize)
  Had problems unarchiving. Please build manually
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Failed during this command:
 JESSE/WWW-Mechanize-1.72.tar.gz              : unwrapped NO -- untar failed

在我看来, $newdir 并未使用动态生成的更新/root/.cpan/build/JESSE-DGrTh_//root/.cpan/build/JESSE-KjCEMS/ 或系统生成的任何内容,或者至少该信息是无法使用 tar 命令

有谁知道如何修复该机制而无需手动安装?

It seems I have a configuration problem when installing Perl modules through CPAN and I don't know how to correct it:

[root@ip JESSE]# pwd
/root/.cpan/sources/authors/id/J/JE/JESSE

[root@ip JESSE]# ls -l
total 240
-rw-r--r-- 1 root root 105464 Feb 20 11:39 CHECKSUMS
-rw-r--r-- 1 root root   9223 Apr 12  2011 Locale-Maketext-Simple-0.21.tar.gz
-rw-r--r-- 1 root root 125483 Feb 20 11:39 WWW-Mechanize-1.72.tar.gz

[root@ip JESSE]# cpan -i WWW::Mechanize
CPAN: Storable loaded ok (v2.20)
Reading '/root/.cpan/Metadata'
  Database was generated on Mon, 20 Feb 2012 11:10:26 GMT
Running install for module 'WWW::Mechanize'
Running make for J/JE/JESSE/WWW-Mechanize-1.72.tar.gz
CPAN: Digest::SHA loaded ok (v5.61)
CPAN: Compress::Zlib loaded ok (v2.033)
Checksum for /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.82)
Uncompressed /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz successfully
Using Tar:/bin/tar xvf "WWW-Mechanize-1.72.tar":
Couldn't untar WWW-Mechanize-1.72.tar
CPAN: File::Temp loaded ok (v0.22)
CPAN: CPAN::Meta loaded ok (v2.112150)
Package seems to come without Makefile.PL.
  (The test -f "/root/.cpan/build/JESSE-n72IRU/Makefile.PL" returned false.)
  Writing one on our own (setting NAME to WWWMechanize)
  Had problems unarchiving. Please build manually
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install

[root@ip JESSE]# ls -l
total 240
-rw-r--r-- 1 root root 105464 Feb 20 11:39 CHECKSUMS
-rw-r--r-- 1 root root   9223 Apr 12  2011 Locale-Maketext-Simple-0.21.tar.gz
-rw-r--r-- 1 root root 125483 Feb 20 11:39 WWW-Mechanize-1.72.tar.gz

[root@ip JESSE]# which tar
/bin/tar

[root@ip JESSE]# which gzip
/bin/gzip

The problem seems to be here:

Uncompressed /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz successfully
Using Tar:/bin/tar xvf "WWW-Mechanize-1.72.tar":
Couldn't untar WWW-Mechanize-1.72.tar

The tar.gz file is indeed uncompressed and can be found here in a new directory:

/root/.cpan/build/JESSE-KjCEMS/WWW-Mechanize-1.72.tar

If I run the same command from inside the shell, I get some more info:

cpan[1]> install WWW::Mechanize
CPAN: Storable loaded ok (v2.20)
Reading '/root/.cpan/Metadata'
  Database was generated on Mon, 20 Feb 2012 11:10:26 GMT
Running install for module 'WWW::Mechanize'
Running make for J/JE/JESSE/WWW-Mechanize-1.72.tar.gz
CPAN: Digest::SHA loaded ok (v5.61)
CPAN: Compress::Zlib loaded ok (v2.033)
Checksum for /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Use of uninitialized value $newdir in substitution (s///) at /usr/lib64/perl5/Cwd.pm line 502.
Use of uninitialized value $newdir in chdir at /usr/lib64/perl5/Cwd.pm line 510.
Use of chdir('') or chdir(undef) as chdir() is deprecated at /usr/lib64/perl5/Cwd.pm line 510.
Use of uninitialized value $newdir in pattern match (m//) at /usr/lib64/perl5/Cwd.pm line 525.
Use of uninitialized value $newdir in split at /usr/lib64/perl5/Cwd.pm line 531.
..........................................................................--DONE
DEL(1/10): /root/.cpan/build/CPAN-1.9600-jGTV10
DEL(2/10): /root/.cpan/build/File-Which-1.09-yoVWZC
DEL(3/10): /root/.cpan/build/Test-Script-1.07-aJWrXb
DEL(4/10): /root/.cpan/build/Probe-Perl-0.01-gzZ2eR
DEL(5/10): /root/.cpan/build/IPC-Run3-0.044-AP6EMp
DEL(6/10): /root/.cpan/build/Time-HiRes-1.9721-xxseE6
DEL(7/10): /root/.cpan/build/CPAN-Meta-YAML-0.003-wGtH0a
DEL(8/10): /root/.cpan/build/JSON-PP-2.27105-fvkwNa
DEL(9/10): /root/.cpan/build/Package-Constants-0.02-7Ms_OL
DEL(10/10): /root/.cpan/build/Module-Metadata-1.000004-tXKIBB
CPAN: Archive::Tar loaded ok (v1.82)
Uncompressed /root/.cpan/sources/authors/id/J/JE/JESSE/WWW-Mechanize-1.72.tar.gz successfully
Using Tar:/bin/tar xvf "WWW-Mechanize-1.72.tar":
Couldn't untar WWW-Mechanize-1.72.tar
CPAN: File::Temp loaded ok (v0.22)
CPAN: CPAN::Meta loaded ok (v2.112150)
Package seems to come without Makefile.PL.
  (The test -f "/root/.cpan/build/JESSE-DGrTh_/Makefile.PL" returned false.)
  Writing one on our own (setting NAME to WWWMechanize)
  Had problems unarchiving. Please build manually
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Failed during this command:
 JESSE/WWW-Mechanize-1.72.tar.gz              : unwrapped NO -- untar failed

It seems to me that $newdir is not being updated with the dynamically generated /root/.cpan/build/JESSE-DGrTh_/ or /root/.cpan/build/JESSE-KjCEMS/ or whatever the system generates or at least that information is not getting to the tar command

Does anyone know how I can fix the mechanism without having to resort to a manual install ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

离笑几人歌 2025-01-14 07:48:08

编辑:

我又遇到了这个问题。我所需要做的就是像基思·布劳顿建议的那样释放一些内存。


我遇到了同样的问题,并试图找到这个问题的根本原因。我在这里列出了我的发现,这样其他 Google 员工就不必在放弃之前花费几个小时...

对我来说,解决这个问题的方法很简单,就是重新启动系统

我尝试过的事情:

  • 升级 CPAN。这也会失败并显示“无法解压”错误消息。如果您使用 cpan shell、“cpan -i CPAN”或“perl -MCPAN -e 'install CPAN'”进行尝试,这并不重要。我认为这些都不能解决问题,但是当您开始谷歌搜索时,所有这些都会被建议为可能的解决方案。
  • 将 tar 替换为一个脚本,该脚本会记录其输入,以检查调用时参数之一或 cwd 是否不正确。该脚本似乎从未被调用过。即使临时重命名 /bin/tar 后,“无法解压”消息仍然相同。
  • 检查 CPAN/Tarzip.pm 并在写入“无法解压”消息的代码附近添加打印行。似乎 system() 调用失败并且 tar (或我的调试代码中的 ls )从未被调用。

然后我决定重新启动,这是一个选项,因为这不是一个实时系统。之后问题就消失了,并且第一次尝试就安装了 Perl 模块。

其他观察结果:

  • 该系统似乎在其他方面工作得很好。您仍然可以连接到系统,可以编辑文件,重启后修改仍然存在。我预计这些中的任何一个都会在 Perl system() 调用开始失败之前很久就失败。
  • 快速扫描日志文件没有显示任何危险信号。

Edit:

I ran into this problem again. All I needed to do was free some memory like Keith Broughton suggested.


I ran into the same problem and tried to find the root cause for this problem. I'm listing my findings here so other Googlers don't have to spend a couple of hours before giving up...

What solved it for me was simply rebooting the system.

Things I tried:

  • Upgrading CPAN. This would also fail with the "Couldn't untar" error message. I doesn't matter if you try it using the cpan shell, "cpan -i CPAN" or "perl -MCPAN -e 'install CPAN'". I didn't think any of these would solve the problem, but when you start googling all these are suggested as possible solutions.
  • Replacing tar with a script that logs its input to check if one of the parameters or cwd is incorrect when it is called. The script is never called it seems. The "Couldn't untar" message is still the same, even after temporarily renaming /bin/tar.
  • Checking CPAN/Tarzip.pm and adding print lines near the code that writes the "Couldn't untar" message. It seems that the system() call fails and tar (or ls in my debug code) is never called.

Then I decided to reboot, which was an option because this is not a live system. After that the problem was gone and Perl modules installed on first try.

Other observations:

  • The system seems to work just fine for the rest. You can still connect to the system, you can edit files, modifications are still there after the reboot. I would expect any of these to fail long before a Perl system() call starts to fail.
  • A quick scan through the logfiles doesn't show any red flags.
多彩岁月 2025-01-14 07:48:08

有时,这种情况的发生可能仅仅是由于缺乏可用内存。尝试关闭一些正在运行的服务,然后重试。

为我工作:-)

Sometimes this can happen simply due to a lack of available memory. Try turning off some services that are running and try again.

Worked for me :-)

眼泪也成诗 2025-01-14 07:48:08

要解决以下错误:

Couldn't untar WWW-Mechanize-1.72.tar

安装 Archive::Tar

尝试在 centos 6.X 上

yum install perl-Archive-Tar.x86_64

To resolve the following error:

Couldn't untar WWW-Mechanize-1.72.tar

Try install Archive::Tar

On centos 6.X:

yum install perl-Archive-Tar.x86_64
朮生 2025-01-14 07:48:08

在运行 Ubuntu 的具有 512MB RAM 的 DigitalOcean Droplet 上发现了同样的问题(大约有 200MB 可用空间)。

我可以通过重新启动机器来解决这个问题,我尝试使用“install Bundle::CPAN”更新我的 CPAN。它适用于前几个模块,然后“无法解压”消息再次出现。

重新启动使我能够继续安装。这些重复的重新启动当然不是最佳解决方案。

鉴于系统有空闲内存,并且在使用机器一段时间后再次出现该问题,这似乎可能与共享库的问题有关。

Found the same issue on DigitalOcean droplet with 512MB RAM running Ubuntu (with about 200MB free).

I was able to solve it by rebooting the machine, I tried updating my CPAN using 'install Bundle::CPAN'. It worked for the first few modules, and then the 'Couldn't untar' message appeared again.

Rebooting allowed me to progress in the installation. These repeated reboots are of course a less than optimal solution.

Given that the system has free memory, and the issue re-appears after using the machine for a little while, it seems to be this could be related to an issue with shared libraries.

原谅我要高飞 2025-01-14 07:48:08

意外的是:分区已满。删除一些文件。

Shot in the blue: partition is full. Delete some files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文