1

Trying to set up a site from production (new to Magento and doing some fixes) and getting this error when running php bin/magento

We're sorry, an error occurred. Try clearing the cache and code generation directories. By default, they are: var/cache, var/di, var/generation, and var/page_cache.

[Magento\Framework\Exception\NoSuchEntityException] No such entity.

From my troubleshooting so far, I have gathered that the error is being thrown because the website ID is not set or associated.

Magento\Framework\Exception\NoSuchEntityException: 
No such entity. in /htdocs/vendor/magento/module-
store/Model/WebsiteRepository.php:104 

Stack trace: 
0: /htdocs/var/generation/Magento/Store/Model/WebsiteRepository/Interceptor.php(37): Magento\Store\Model\WebsiteRepository->getById('1')

1: /htdocs/vendor/magento/module-store/Model/StoreManager.php(201): Magento\Store\Model\WebsiteRepository\Interceptor->getById('1') 

2: /htdocs/var/generation/Magento/Store/Model/StoreManager/Interceptor.php(102): Magento\Store\Model\StoreManager->getWebsite('1') 

3: /htdocs/var/generation/Magento/Store/Model/StoreManagerInterface/Proxy.php(135): Magento\Store\Model\StoreManager\Interceptor->getWebsite('1') 

4: /htdocs/vendor/magento/module-store/Model/Resolver/Website.php(30): Magento\Store\Model\StoreManagerInterface\Proxy->getWebsite('1') 

5: /htdocs/vendor/magento/framework/App/Config/ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Website->getScope('1') 

6: /htdocs/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(82): Magento\Framework\App\Config\ScopeCodeResolver->resolve('websites', '1') 

7: /htdocs/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(58): Magento\Config\App\Config\Source\RuntimeConfigSource->loadConfig() 

8: /htdocs/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40): Magento\Config\App\Config\Source\RuntimeConfigSource->get('') 

9: /htdocs/vendor/magento/module-config/App/Config/Type/System/Reader.php(73): Magento\Framework\App\Config\ConfigSourceAggregated->get() 

10: /htdocs/var/generation/Magento/Config/App/Config/Type/System/Reader/Proxy.php(95): Magento\Config\App\Config\Type\System\Reader->read() 

11: /htdocs/vendor/magento/module-config/App/Config/Type/System.php(212): Magento\Config\App\Config\Type\System\Reader\Proxy->read() 

12: /htdocs/vendor/magento/module-config/App/Config/Type/System.php(170): Magento\Config\App\Config\Type\System->loadDefaultScopeData('default') 

13: /htdocs/vendor/magento/framework/App/Config.php(139): Magento\Config\App\Config\Type\System->get('default/web/sec...') 

14: /htdocs/var/generation/Magento/Framework/App/Config/Interceptor.php(63): Magento\Framework\App\Config->get('system', 'default/web/sec...', NULL) 

15: /htdocs/vendor/magento/framework/App/Config.php(90): Magento\Framework\App\Config\Interceptor->get('system', 'default/web/sec...') 

16: /htdocs/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\Config->getValue('web/secure/use_...', 'default', NULL) 

17: /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\Config\Interceptor->___callParent('getValue', Array) 

18: /htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'getValue', Object(Magento\Framework\App\Config\Interceptor), Array, 'mageworx_shippi...') 

19: /htdocs/app/code/MageWorx/ShippingRules/Model/Plugin/AddMethods.php(54): Magento\Framework\App\Config\Interceptor->Magento\Framework\Interception\{closure}('web/secure/use_...', 'default', NULL) 

20: /htdocs/vendor/magento/framework/Interception/Interceptor.php(142): MageWorx\ShippingRules\Model\Plugin\AddMethods->aroundGetValue(Object(Magento\Framework\App\Config\Interceptor), Object(Closure), 'web/secure/use_...', 'default', NULL) 

21: /htdocs/var/generation/Magento/Framework/App/Config/Interceptor.php(26): Magento\Framework\App\Config\Interceptor->___callPlugins('getValue', Array, Array) 

22: /htdocs/vendor/magento/framework/App/Config.php(103): Magento\Framework\App\Config\Interceptor->getValue('web/secure/use_...', 'default', NULL) 


23: /htdocs/var/generation/Magento/Framework/App/Config/Interceptor.php(37): Magento\Framework\App\Config->isSetFlag('web/secure/use_...', 'default', NULL) 

24: /htdocs/vendor/magento/module-store/Model/HeaderProvider/Hsts.php(48): Magento\Framework\App\Config\Interceptor->isSetFlag('web/secure/use_...') 

25: /htdocs/vendor/magento/framework/App/Response/HeaderManager.php(41): Magento\Store\Model\HeaderProvider\Hsts->canApply() 

26: /htdocs/vendor/magento/framework/Interception/Interceptor.php(123): Magento\Framework\App\Response\HeaderManager->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor)) 

27: /htdocs/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(117): Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array) 

28: /htdocs/vendor/magento/framework/App/Http.php(185): Magento\Framework\App\Response\Http\Interceptor->sendResponse() 

29: /htdocs/vendor/magento/framework/App/Http.php(156):Magento\Framework\App\Http->handleDeveloperMode(Object(Magento\Framework\App\Bootstrap), Object(Magento\Framework\Exception\NoSuchEntityException)) 

30: /htdocs/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->catchException(Object(Magento\Framework\App\Bootstrap), Object(Magento\Framework\Exception\NoSuchEntityException)) 

31: /htdocs/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http)) 

32: {main}
  • remove all this directory var/cache, var/di, var/generation, and var/page_cache and then try again. – Abhishek Panchal Feb 13 '18 at 19:22
1

Run these commands below, the key is removing the var/* folders.

alias mage="php -d memory_limit=-1 -f bin/magento"    
chmod -R 775 pub/static/ pub/media/ var/
chmod +x bin/magento
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/di/ var/tmp/ var/generation/ pub/static/frontend/ ;
mage setup:upgrade 
mage cache:flush 
mage setup:static-content:deploy -j 10
mage setup:di:compile
mage deploy:mode:set production -s
mage maintenance:disable

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.