magento2: Pipeline deployment build failed "Uncaught Error: Call to a member function getPackage()"
PHP Fatal error: Uncaught Error: Call to a member function getPackage() on null in vendor/magento/module-deploy/Package/Processor/PostProcessor/CssUrls.php:215
This fails only on build system but works fine in development system if i run same deployment command.
Preconditions
- Magento 2.2
- PHP 7.0.19
- Merge css enabled
Steps to reproduce
- Run app:config:dump on development system
- Commit code to git
- Pull code to build system with same environment
- Run php bin/magento setup:static-content:deploy -f en_US
Expected result
- Static content get deployed succesfully
Actual result
- Getting
PHP Fatal error: Uncaught Error: Call to a member function getPackage() on null in vendor/magento/module-deploy/Package/Processor/PostProcessor/CssUrls.php:215
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 7
- Comments: 30 (2 by maintainers)
Hi, we have similar problem. Workaround for that is remove generated data before deploy. If
var/view_preprocessed
exists magento using data from this dir.rm -rf pub/static/* var/view_preprocessed/pub/*
php bin/magento setup:static-content:deploy -f en_US
Here is my old question on stackexchange related to this issue: Magento 2.2 Build system
@magento-engcom-team Can you please reopen this ticket? The issue is still present.
Same issue for me with Magento 2.3.4 using deployer
I found that for me it was happening due to email css files email.css and email-inline.css in my custom theme, instead of .less and the line that was causing this issue was at the top with the code:
@import url("{{base_url_path}}frontend/Magento/luma/{{locale}}/css/email-fonts.css");
and found that the issue was due to the variable {{base_url_path}} instead i changed the code to@import url("{{baseUrl}}/css/email-fonts.css");
and the error was gone.Looks like the issue has never been fixed. It’s reproducible on the latest 2.2.x and 2.3.x branches. @magento-engcom-team Could you please reopen the ticket?
I had this error when I override css files in my template. I had a bad css file.
I check permission and format of file who stuck process with l:218 vendor/magento/module-deploy/Package/Processor/PostProcessor/CssUrls.php :
Hi @magento-engcom-team ,
this error occurs when minify CSS files configuration has value true (Stores->Configuration->Advanced->Developer->Css Settings->Minify CSS Files).
and it is reproduced even after fresh installation.
This is reproducible in 2.3.1 as well when deploying static content in deployment pipeline and:
is added to config.php
It seems to be a magento bug 😦 . The way to reverse it is the following (I know this is not a solution) but it will help to have the site working again:
On command line:
Magento ≥ 2.2 bin/magento config:set dev/css/minify_files 0 bin/magento cache:clean
Magento < 2.2 On DB (mysql client) execute: UPDATE core_config_data SET value = 0 WHERE 'dev/css/minify_files
bin/magento cache:clean
Now, you can compile again.
Hi,
I also faced the same issue and reason of getting this issue was–
I added the ht-access in var folder and removed the default CSS files from the web folder of the newly created theme and then got the success in deploy without any issue.
Thanks