1

I've had an issue with a template I purchased and needed to update it to the latest version of Magento.

I've backed up my database a files and ran: composer update

When this complete I ran php bin/magento setup:upgrade and it has returned with: when setup upgrade after add extention module, error occur

[InvalidArgumentException] There are no commands defined in the "setup" namespace.

The front end of my site is now returning with:

Fatal error: Uncaught exception 'Magento\Framework\Exception\FileSystemException' with message 'The file "/h/d/ph/var/generation/Magento/Framework/Config/Composer/PackageFactory.php" cannot be deleted Warning!unlink(/home/sparkled/public_html/var/generation/Magento/Framework/Config/Composer/PackageFactory.php): Permission denied' in /h/d/ph/vendor/magento/framework/Filesystem/Driver/File.php:382 

Stack trace: 
#0 /h/d/ph/vendor/magento/framework/Filesystem/Driver/File.php(405): Magento\Framework\Filesystem\Driver\File->deleteFile('/home/sparkled/...') 
#1 /h/d/ph/vendor/magento/framework/Filesystem/Driver/File.php(403): Magento\Framework\Filesystem\Driver\File->deleteDirectory('/home/sparkled/...') 
#2 /h/d/ph/vendor/magento/framework/Filesystem/Driver/File.php(403): Magento\Framework\Filesystem\Driver\File->deleteDirectory('/home/sparkled/...') 
#3 /h/d/ph/vendor/magento/framework/Filesystem/Driver/File.php(403): in /h/d/ph/vendor/magento/framework/Filesystem/Driver/File.php on line 382

Any ideas on how to fix this issue or would it be best to just use my backup to restore?
Would this be a case of doing something with PackageFactory.php?
Permissions are set to 0664

4
  • would this be a case of doing something with packagefactory.php? permissions are set to 0664 Mar 2, 2017 at 14:35
  • Agreed, try and delete var/generation and run it again. I've just updated to 2.1.5 and received no errors.
    – tecjam
    Mar 2, 2017 at 14:45
  • Site has come back online after deleting var/generation however version has not updated. Mar 2, 2017 at 16:13
  • maybe something went wrong in your composer update. I always delete vendor/ and change the version myself in composer.json to 2.1.5 -> magento.stackexchange.com/questions/98332/…
    – tecjam
    Mar 2, 2017 at 16:17

3 Answers 3

0

Some basic troubleshooting steps:

# from magento root
rm -rf vendor
rm -rf var/di var/generation var/cache
magento cache:flush # somewhat redundant
# try resetting permissions again, for instance as specified:
# http://magento.stackexchange.com/questions/91870/magento-2-folder-file-permissions

# these commands take a few minutes
composer update
magento setup:upgrade
magento setup:di:compile # this may be redeundant in developer mode

By removing vendor you're letting composer do its thing. By removing those cache directories you're letting magento do its generation thing. Then, once the directory is clean, that's a good time to reset filesystem permissions.

0

I was able to fix my problem and commence with the version update by doing the following:

deleted var/generation

composer require magento/product-community-edition 2.1.5 --no-update

composer update

rm -rf var/di var/generation

php bin/magento cache:clean

php bin/magento cache:flush

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento indexer:reindex

Checked Magento version with the following command:

php bin/magento --version

Complete Working.

thanks all for your help

0

Connect your store with SSH and go to the root directory of your store.

First, run the following command:

composer require magento/product-community-edition 2.1.5 --no-update

Now update the composer:

composer update

Now run these commands to clean cache:

rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/*

php bin/magento cache:clean

php bin/magento cache:flush

Upgrade the setup by running this command:

php bin/magento setup:upgrade

Compile the setup by running this command:

php bin/magento setup:di:compile

At last, reindex the indexers:

php bin/magento indexer:reindex

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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