I have installed this package success locally composer require spatie/laravel-image-optimizer, but when I tried to install on the live server I got this errors<
You should not call composer require or composer update on production server - you should run it locally, verify that everything works fine, and commit generated composer.lock with your project. Then on production server you need to run only composer install --no-dev - it will install all non-dev dependencies defined in lock file. composer install is much faster and uses fraction of RAM required by composer require or composer update, so it should work fine even on server with low memory. It also gives you more control on version of libraries installed on production server, so you can test app more reliable.