I’ve just installed (uploaded) a new extension onto my Magento2 store, however after compiling and deploying I constantly run into the following error:
1 exception(s):
Exception #0 (Exception): Warning: file_put_contents(/var/www/html/pub/static/frontend/smart_media/smart_media1/th_TH/css/themes.css): failed to open stream: No such file or directory in /var/www/html/vendor/oyejorge/less.php/lessc.inc.php on line 177
Exception #0 (Exception): Warning: file_put_contents(/var/www/html/pub/static/frontend/smart_media/smart_media1/th_TH/css/themes.css): failed to open stream: No such file or directory in /var/www/html/vendor/oyejorge/less.php/lessc.inc.php on line 177
#0 [internal function]: MagentoFrameworkAppErrorHandler->handler(2, 'file_put_conten...', '/var/www/html/v...', 177, Array)
#1 /var/www/html/vendor/oyejorge/less.php/lessc.inc.php(177): file_put_contents('/var/www/html/p...', '/* Less Variabl...')
#2 /var/www/html/app/code/Rokanthemes/Themeoption/Observer/RefreshStyleObserver.php(58): lessc->compileFile('/var/www/html/a...', '/var/www/html/p...')
#3 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(72): RokanthemesThemeoptionObserverRefreshStyleObserver->execute(Object(MagentoFrameworkEventObserver))
#4 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(60): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod(Object(RokanthemesThemeoptionObserverRefreshStyleObserver), Object(MagentoFrameworkEventObserver))
#5 /var/www/html/vendor/magento/framework/Event/Manager.php(66): MagentoFrameworkEventInvokerInvokerDefault->dispatch(Array, Object(MagentoFrameworkEventObserver))
#6 /var/www/html/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): MagentoFrameworkEventManager->dispatch('layout_generate...', Array)
#7 /var/www/html/vendor/magento/framework/View/Layout/Builder.php(134): MagentoFrameworkEventManagerProxy->dispatch('layout_generate...', Array)
#8 /var/www/html/vendor/magento/framework/View/Page/Builder.php(55): MagentoFrameworkViewLayoutBuilder->generateLayoutBlocks()
#9 /var/www/html/vendor/magento/framework/View/Layout/Builder.php(65): MagentoFrameworkViewPageBuilder->generateLayoutBlocks()
#10 /var/www/html/vendor/magento/framework/View/Layout.php(254): MagentoFrameworkViewLayoutBuilder->build()
#11 /var/www/html/vendor/magento/framework/View/Layout.php(876): MagentoFrameworkViewLayout->build()
#12 /var/www/html/vendor/magento/module-cms/Helper/Page.php(171): MagentoFrameworkViewLayout->getBlock('page_content_he...')
#13 /var/www/html/vendor/magento/module-cms/Controller/Index/Index.php(43): MagentoCmsHelperPage->prepareResultPage(Object(MagentoCmsControllerIndexIndexInterceptor), 'home')
#14 /var/www/html/vendor/magento/framework/App/Action/Action.php(107): MagentoCmsControllerIndexIndex->execute()
#15 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppActionAction->dispatch(Object(MagentoFrameworkAppRequestHttp))
#16 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoCmsControllerIndexIndexInterceptor->___callParent('dispatch', Array)
#17 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCmsControllerIndexIndexInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#18 /var/www/html/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(26): MagentoCmsControllerIndexIndexInterceptor->___callPlugins('dispatch', Array, Array)
#19 /var/www/html/vendor/magento/framework/App/FrontController.php(55): MagentoCmsControllerIndexIndexInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#20 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoFrameworkAppFrontController->dispatch(Object(MagentoFrameworkAppRequestHttp))
#21 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): MagentoFrameworkAppFrontControllerInterceptor->___callParent('dispatch', Array)
#22 /var/www/html/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#23 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): MagentoStoreAppFrontControllerPluginRequestPreprocessor->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#24 /var/www/html/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#25 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): MagentoPageCacheModelAppFrontControllerBuiltinPlugin->aroundDispatch(Object(MagentoFrameworkAppFrontControllerInterceptor), Object(Closure), Object(MagentoFrameworkAppRequestHttp))
#26 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): MagentoFrameworkAppFrontControllerInterceptor->MagentoFrameworkInterception{closure}(Object(MagentoFrameworkAppRequestHttp))
#27 /var/www/html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): MagentoFrameworkAppFrontControllerInterceptor->___callPlugins('dispatch', Array, Array)
#28 /var/www/html/vendor/magento/framework/App/Http.php(135): MagentoFrameworkAppFrontControllerInterceptor->dispatch(Object(MagentoFrameworkAppRequestHttp))
#29 /var/www/html/vendor/magento/framework/App/Bootstrap.php(256): MagentoFrameworkAppHttp->launch()
#30 /var/www/html/pub/index.php(37): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttpInterceptor))
#31 {main}
I’ve searched for many solutions, tried to fix permissions, re-deploy static content, remove generated folder, change permissions etc. but to no avail. Some expert insight would be greatly appreciated. Thank you very much
2
Answers
It sounds like potentially the directory target it is trying to write to (
smart_media/smart_media1/th_TH/css
) does not exist. You may need to modify the extension so that it creates the directory prior to attempting to write to it.Looks like there are permission issues. You can check magento docs to set the right permissions. You can try these commands