作曲家无法安装和更新



我几周前在服务器上做同样的事情,但现在我做不到。这是我的错误输出:

作曲家安装

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]: ComposerUtilErrorHandler::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): SymfonyComponentConsoleApplication->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(754): SymfonyComponentConsoleApplication->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(688): SymfonyComponentConsoleApplication->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]: ComposerUtilErrorHandler::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): SymfonyComponentConsoleApplication->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(754): SymfonyComponentConsoleApplication->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(688): SymfonyComponentConsoleApplication->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 974`

i曾经有这个问题,增加了内存限制。您可以尝试一下。

要解决此问题,增加交换内存:

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

将Composer.lock添加到跟踪文件解决问题。

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

然后,

git clone ....

在服务器中。

解决问题。

反正谢谢。

例如,如果您在虚拟环境下运行,例如,请确保启用交换。在脚本下运行以创建交换

#!/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/srao/2014/05/youcompleteme-install-fails-fails-due-to-internal-compiler-error/

我面临着同一问题,以下命令解决了我的问题。

sudo作曲家自上行

//这将设置内存。php -dmemory_limit = -1作曲家更新

sudo php -dmemory_limit = -1作曲家更新

在更新Symfony项目具有较大依赖性的情况下也有类似的问题。创建交换文件有助于:https://www.digitalocean.com/community/tutorials/how-to-to-to-add-swap-on-ubuntu-12-04

要解决此问题,您已经运行了2个命令。
shailesh@ubuntu $/var/www $ sudo/bin/dd if =/dev/零=/var/swap.1 bs = 1m count = 1024
输出将看起来像这样:
1024 0记录1024 0记录1073741824字节(1.1 GB)复制,13.1359 s,81.7 Mb/s

和之后运行
shailesh@ubuntu $ sudo/sbin/mkswap/var/swap.1
输出将就像:
设置交换空间1,尺寸= 1048572 KIB无标签,UUID = 486B676C-AA2A-4329-9783-6D1E6A9EB0A5

和最终命令您必须运行
shailesh@ubuntu $ sudo/sbin/swapon/var/swap.1

现在运行作曲家更新并节省时间。

这对我有用 php -dmemory_limit=1GB $(which composer) update

相关内容

  • 没有找到相关文章

最新更新