我几周前在服务器上做了同样的事情,但现在我不能。这是我的错误输出:
composer install
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`
答案 0 :(得分:3)
我曾经有过这个问题,增加内存限制解决了它。你可以尝试一下。
答案 1 :(得分:1)
将composer.lock添加到跟踪文件解决了问题。
git add -f composer.lock
git add .
git commit -m 'remove composer.lock from ignored files'
git push
然后,
git clone ....
在服务器中。
问题解决了。
非常感谢。
答案 2 :(得分:1)
如果您在虚拟环境(如vagrant)下运行,请确保已启用交换。在脚本下运行以创建交换
#!/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/
答案 3 :(得分:1)
要解决此问题,请增加交换内存:
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
答案 4 :(得分:0)
我在更新命令下遇到同样的问题解决了我的问题。
sudo作曲家自我更新
//这将设置内存。 php -dmemory_limit = -1 composer update
或
sudo php -dmemory_limit = -1 composer update
答案 5 :(得分:0)
在更新具有大依赖性的symfony项目时遇到类似问题。创建交换文件有帮助: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04
答案 6 :(得分:0)
要解决此问题,您必须运行2命令
shailesh @ ubuntu $ / var / www $ sudo / bin / dd if = / dev / zero of = / 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
现在运行编辑器更新并节省时间。
答案 7 :(得分:0)
这对我有用php -dmemory_limit=1GB $(which composer) update