Mon, 08/03/2020 – 04:27
If you are using shared web hosting for your composer managed Drupal website, you have probably ran into the problem of your server running out of memory for simple commands such as “composer install”. Shared web hosting usually have memory limits which are shared across many websites.
This problem becomes quickly apparent if you are trying to install a new Drupal website into your shared hosting account. Because this is probably the first time that you have to run “composer install” for this website. Composer will then have to go and fetch all the files and download them into your vendor directory. This process is memory intensive. The end result is your process is abruptly killed without finishing.
A quick and easy solution is to install the site locally whereby you can successfully run “composer install”. You would then have the vendor directory locally. Then use a service like FTP to manually upload the vendor folder into the correct directory on your hosting server. Then on your hosting server, try running “composer install” again.
At this point, composer would not need to fetch all the files again. Composer may or may not have to update some files in the vendor directory. This is OK. But the process should now be able to complete within your memory limitations.
It should be noted that the vendor directory should not be committed to your git directory for a few important reasons.