2014-01-21 261 views
0

幾周前,我在服務器上做了同樣的事情,但現在我不能。這是我的錯誤輸出:作曲家無法安裝和更新

作曲家安裝

Loading composer repositories with package information 
Installing dependencies (including require-dev) 
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:974 
Stack trace: 
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 974, Array) 
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(974): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array) 
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(793): Symfony\Component\Console\Application->getSttyColumns() 
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(754): Symfony\Component\Console\Application->getTerminalDimensions() 
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(688): Symfony\Component\Console\Application->getTerminalWidth() 
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 974 

Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:974 
Stack trace: 
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 974, Array) 
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(974): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array) 
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(793): Symfony\Component\Console\Application->getSttyColumns() 
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(754): Symfony\Component\Console\Application->getTerminalDimensions() 
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(688): Symfony\Component\Console\Application->getTerminalWidth() 
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 974` 

回答

3

我曾經有過這個問題,增加內存限制解決它。你可以試試看。

+0

你會如何做到這一點?在php.ini文件中? –

1

將composer.lock添加到跟蹤文件解決了問題。

git add -f composer.lock 
git add . 
git commit -m 'remove composer.lock from ignored files' 
git push 

然後,

git clone .... 
服務器

問題解決。

無論如何。

+0

您必須提交'composer.lock'文件,否則對'composer install'的調用實際上會像'composer update'一樣運行,這會耗費內存,並且可能不會安裝您測試的版本。 – Sven

0

我在update命令下遇到同樣的問題解決了我的問題。

sudo作曲家自我更新

//這會設置記憶。 PHP -dmemory_limit = -1作曲家更新

sudo的PHP -dmemory_limit = -1作曲家更新

1

如果你像流浪者,例如虛擬環境下運行,然後確保交換被啓用。下面的腳本運行以創建交換

#!/bin/sh 

# size of swapfile in megabytes 
swapsize=512 

# does the swap file already exist? 
grep -q "swapfile" /etc/fstab 

# if not then create it 
if [ $? -ne 0 ]; then 
    echo 'swapfile not found. Adding swapfile.' 
    fallocate -l ${swapsize}M /swapfile 
    chmod 600 /swapfile 
    mkswap /swapfile 
    swapon /swapfile 
    echo '/swapfile none swap defaults 0 0' >> /etc/fstab 
else 
    echo 'swapfile found. No changes made.' 
fi 

# output results to terminal 
cat /proc/swaps 
cat /proc/meminfo | grep Swap 

來源:http://www.nyayapati.com/srao/2014/05/youcompleteme-install-fails-due-to-internal-compiler-error/

0

要解決此問題,增加交換內存:

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 
/sbin/mkswap /var/swap.1 
/sbin/swapon /var/swap.1 
0

爲了解決已運行2命令這個問題。
SHAILESH @ $的ubuntu的/ var/WWW $ sudo的/ bin中/ DD如果=的/ dev/=/VAR/swap.1 BS = 1M的零數= 1024
輸出將看起來像這樣:
1024 + 0記錄 1024 + 0記錄了 1073741824字節(GB 1.1)複製,13.1359 S,81.7 MB/s的

和運行
SHAILESH @ Ubuntu的$ sudo的/ sbin目錄/再用mkswap在/ var /交換後。1
輸出將是這樣的:
設置交換空間的版本1,大小= 1048572昆明植物研究所 沒有標籤,UUID = 486b676c-aa2a-4329-9783-6d1e6a9eb0a5

和最後的命令,你必須運行
shailesh @ ubuntu $ sudo/sbin/swapon /var/swap.1

現在運行composer update並保存時間。