I'm trying to upgrade my magento 2.2.3 to 2.2.4 through putty:

php70 composer require magento/product-community-edition 2.2.4 --no-update
php70 composer/composer.phar update

and after this I try:

php70 bin/magento setup:upgrade

but here I get this error:

Could not open input file: bin/magento

I have also tryed to rewrite the permissions, but is not this the problem, the thing is the content in bin gets literally deleted.

  • Nothing in the upgrade process should be deleting bin/magento. Do ls bin (or equivalent file list command) to see if the magento file is actually there or missing – andyjv Aug 6 '18 at 15:22
  • Also see if there's any errors in the Magento or server logs – andyjv Aug 6 '18 at 15:25
  • magento file is properly missing after I do the composer update – alexcr Aug 6 '18 at 15:38
  • my composer.json file might be missing something, even if I try to update composer without the require 2.2.4, I get the bin/magento missing error – alexcr Aug 6 '18 at 16:01
  • and if I try to upgrade through backend System Upgrade, I get this error: We're sorry, no components are available because you cloned the Magento 2 GitHub repository. You must manually update components as discussed in the Installation Guide. – alexcr Aug 6 '18 at 16:03

I have had this happen a number of times with Community/Open Source but for some reason it doesn't happen on Enterprise.

The only way I have ever been able to solve this is this:

  1. Make sure any custom work is committed to the respective repo so you don't lose it.
  2. Copy your app/etc/env.php and app/etc/config.php, and composer.json files to some temporary location like your desktop bc you'll need them again shortly.
  3. Delete the entire Magento file structure.
  4. Reinstall Magento using Composer, ensuring that you specify the correct version number. I assume 2.2.4. Don't run through the php commands, just install the file structure using Composer and then stop.
  5. Open the copy of composer.json that you set aside earlier and make sure that the Magento version in there is also specified as 2.2.4. Save it and close it.
  6. Drop app/etc/env.php and app/etc/config.php, and composer.json back into their appropriate locations in the Magento file structure.
  7. Run composer update
  8. php bin/magento setup:upgrade
  9. php bin/magento indexer:reindex
  10. php bin/magento cache:clean

Yes, it's clunky as hell but I can't seem to figure out why bin/magento and many other files seem to disappear during some, but not all, upgrades. After you run these steps, you should be on the new version of Magento and everything should be normal again.


Sometimes during upgrades there are conflicts in the static files or in the dependency injection that prevent bin/magento from running.

You can try clearing your cache, static files, and DI with this command:

rm -r var/page_cache/* var/cache/* generated/code/* generated/metadata/* var/view_preprocessed/*

Then try running bin/magento.

  • I have also tryed to do this after the composer update, also chmod 777 var -R and pub -R, and still nothing, get the same error, and the bin folder is still empty – alexcr Aug 6 '18 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.