I try to deploy the static content php bin/magento setup:static-content:deploy -f da_DK en_US

But the following error occured.

frontend/Magento/blank/da_DK            2291/2291           ============================ 100% %  13 secs
adminhtml/Magento/backend/da_DK         2161/2161           ============================ 100% %  2 secs
frontend/booking/stylish/da_DK          2043/2322           ========================>--- 87% %   8 secs
PHP Fatal error:  Uncaught Error: Call to a member function getPackage() on null in /home/vhosts/dev_site/public_html/vendor/magento/module-deploy/Package/Processor/PostProcessor/CssUrls.php:215
Stack trace:
#0 /home/vhosts/dev_site/public_html/vendor/magento/module-deploy/Package/Processor/PostProcessor/CssUrls.php(109): Magento\Deploy\Package\Processor\PostProcessor\CssUrls->getValidExternalUrl('{{base_url_path...', Object(Magento\Deploy\Package\Package))
#1 /home/vhosts/dev_site/public_html/vendor/magento/module-deploy/Package/Processor/PostProcessor/CssUrls.php(80): Magento\Deploy\Package\Processor\PostProcessor\CssUrls->parseCss(Array, 'css/email-inlin...', 'frontend/bookin...', '@import url("{{...', Object(Magento\Deploy\Package\Package))
#2 /home/vhosts/dev_site/public_html/vendor/magento/module-deploy/Service/DeployPackage.php(151): Magento\Deploy\Package\Processor\PostProcessor\CssUrls->process(Object(Magento\Deploy\Package\Package), Array)

I have tried the solution from this answer, so I deleted everyting from view_processed, and everything from pub/static as suggested

rm -rf pub/static/* 
rm -rf var/view_preprocessed/pub

But it didn't solve my problem.

How can I fix this issue?

  • Please check your extenal urls like js may be this external url not getting file from that location. – Charul Tyagi Aug 27 '18 at 5:23
  • @CharulTyagi I found it out. It's actually not js, but in a CSS file, where I called another CSS with a wrong path. Thanks for your hint. I'm able to deploy static content now. – Magento Learner Aug 28 '18 at 8:30

Your Answer

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

Browse other questions tagged or ask your own question.