Laravel安装程序安装失败

时间:2018-01-12 20:09:08

标签: laravel ubuntu

当我尝试安装Laravel时:

composer global require "laravel/installer"

我会收到此错误:

Installation failed, deleting ./composer.json.
The following exception is caused by a lack of memory and not having swap     configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

我想我用这些命令修复了它。我这是正确的方法吗?有谁知道?

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
mkswap /swapfile
swapon /swapfile

我正在使用Digitalocean并使用512 MB / 20 GB磁盘/ Ubuntu 16.04.3 x64

2 个答案:

答案 0 :(得分:0)

是的,这是解决方案,或者您可以按照本文关于digitalocean:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

答案 1 :(得分:0)

而是global require使用composer create-project --prefer-dist laravel/laravel project

或创建composer.json文件。将内容放入其中,然后运行composer install,因为composer install占用的内存少于composer update

希望这有帮助。