better option is to add package information in package.json and then run this command 

php -dmemory_limit=1G ./composer.phar update


this happens when Ram is not free. We need to create swap memory for getting these things done 


Detailed Article : https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors
COmmand :




free -m

total used free shared buffers cached
Mem: 2048 357 1690 0 0 237
-/+ buffers/cache: 119 1928
Swap: 0 0 0

To enable the swap you can use for example:

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