Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cpan(1) fails with 'Cannot allocate memory'

I'm getting the following error 'Cannot allocate memory' when attempting to install the Moose package for Perl.

Can anyone advise what is wrong here?

ricky@rickyp:~$ sudo cpan install Moose
Reading '/home/ricky/.cpan/Metadata'
  Database was generated on Wed, 29 Jul 2015 21:41:02 GMT
Running install for module 'Moose'
Running make for E/ET/ETHER/Moose-2.1405.tar.gz
Checksum for /home/ricky/.cpan/sources/authors/id/E/ET/ETHER/Moose-2.1405.tar.gz ok
Uncompressed /home/ricky/.cpan/sources/authors/id/E/ET/ETHER/Moose-2.1405.tar.gz successfully
Using Tar:/bin/tar xf "Moose-2.1405.tar":
Couldn't untar Moose-2.1405.tar: 'Cannot allocate memory'
Package seems to come without Makefile.PL.
  (The test -f "/home/ricky/.cpan/build/ETHER-Al52av/Makefile.PL" returned false.)
  Writing one on our own (setting NAME to Moose)
  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
ricky@rickyp:~$
like image 848
Ricky Avatar asked Jul 29 '15 22:07

Ricky


2 Answers

Answering so it is no longer unanswered. The OP solved his problem by using cpanm.

If you have problems installing modules, cpanp may be another alternative to cpan you can look at.

like image 155
bytepusher Avatar answered Oct 18 '22 13:10

bytepusher


If you're using cpan(1) on a system with limited memory, such as a bottom-level hosting account, it's likely that CPAN.pm can't fit the module index in memory or takes up most of the memory you do have. CPAN the repository is huge now, so what used to be a small index file is pretty large. Indeed, it's the most annoying part of the process for me since it takes a noticeably long time to download and load.

cpanminus (cpanm) does things different by using the MetaCPAN API to look up the info it needs. It has a really small memory footprint.

Or, you could be running something else at the same time that's taking up memory.

like image 40
brian d foy Avatar answered Oct 18 '22 15:10

brian d foy