Question

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

Was it helpful?

Solution 2

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

OTHER TIPS

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.

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
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top