Just updated from Magento 2.1.10 to 2.2.2, and keep receiving the following when I deploy static content. Any insights on what the errors signify?

#0 /app/web/vendor/magento/framework/App/View/Asset/Publisher.php(73): Magento\Framework\View\Asset\File->getSourceFile()
#1 /app/web/vendor/magento/framework/App/View/Asset/Publisher.php(61): Magento\Framework\App\View\Asset\Publisher->publishAsset(Object(Magento\Framework\View\Asset\File))
#2 /app/web/vendor/magento/module-deploy/Service/DeployStaticFile.php(89): Magento\Framework\App\View\Asset\Publisher->publish(Object(Magento\Framework\View\Asset\File))
#3 /app/web/vendor/magento/module-deploy/Service/DeployPackage.php(189): Magento\Deploy\Service\DeployStaticFile->deployFile('css/style.less', Array)
#4 /app/web/vendor/magento/module-deploy/Service/DeployPackage.php(136): Magento\Deploy\Service\DeployPackage->processFile(Object(Magento\Deploy\Package\PackageFile), Object(Magento\Deploy\Package\Package))
#5 /app/web/vendor/magento/module-deploy/Service/DeployPackage.php(107): Magento\Deploy\Service\DeployPackage->deployEmulated(Object(Magento\Deploy\Package\Package), Array, false)
#6 [internal function]: Magento\Deploy\Service\DeployPackage->Magento\Deploy\Service\{closure}()
#7 /app/web/vendor/magento/framework/App/State.php(186): call_user_func_array(Object(Closure), Array)
#8 /app/web/vendor/magento/module-deploy/Service/DeployPackage.php(108): Magento\Framework\App\State->emulateAreaCode('frontend', Object(Closure))
#9 /app/web/vendor/magento/module-deploy/Process/Queue.php(281): Magento\Deploy\Service\DeployPackage->deploy(Object(Magento\Deploy\Package\Package), Array)
#10 /app/web/vendor/magento/module-deploy/Process/Queue.php(200): Magento\Deploy\Process\Queue->execute(Object(Magento\Deploy\Package\Package))
#11 /app/web/vendor/magento/module-deploy/Process/Queue.php(162): Magento\Deploy\Process\Queue->assertAndExecute('frontend/CustomVendor/i...', Array, Array)
#12 /app/web/vendor/magento/module-deploy/Strategy/QuickDeploy.php(76): Magento\Deploy\Process\Queue->process()
#13 /app/web/vendor/magento/module-deploy/Service/DeployStaticContent.php(109): Magento\Deploy\Strategy\QuickDeploy->deploy(Array)
#14 /app/web/setup/src/Magento/Setup/Console/Command/DeployStaticContentCommand.php(140): Magento\Deploy\Service\DeployStaticContent->deploy(Array)
#15 /app/web/vendor/symfony/console/Command/Command.php(242): Magento\Setup\Console\Command\DeployStaticContentCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/web/vendor/symfony/console/Application.php(843): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/web/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Setup\Console\Command\DeployStaticContentCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/web/vendor/magento/framework/Console/Cli.php(104): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /app/web/vendor/symfony/console/Application.php(117): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /app/web/bin/magento(23): Symfony\Component\Console\Application->run()
#21 {main}

  Cannot read contents from file "/app/web/pub/static/frontend/CustomVendor/custom/en_US/css/style.min.css" Warning!file_get_con  
  tents(/app/web/pub/static/frontend/CustomVendor/custom/en_US/css/style.min.css): failed to open stream: No such file or directory 

Also, does anyone know if the js-translation.json are among the last to be deployed? They're not generated, so I'm assuming it happens at the end.


  • Just figured out that I can get to work if I run: bin/magento setup:static-content:deploy en_US --no-css , so that allows the previously missing js-translation.json file to generate. But I'm still unsure what's wrong otherwise, as in why that style.min.css file is missing or why Magento is expecting it.
    – brackfost
    Commented Jan 10, 2018 at 18:35
  • have you tried running this after clearing the var/di folder? we got stuck on a similar problem and that cleaned up the issue for us. It also might be worth clearing the var/view_preprocess folder as well.
    – circlesix
    Commented Jan 13, 2018 at 18:34
  • You know, there actually isn't a var/di folder. Clearing var/view_preprocess and then running the deploy without the "no-css" option didn't work, either. Only solution so far is bin/magento setup:static-content:deploy en_US --no-css, which isn't exactly a solution.
    – brackfost
    Commented Jan 16, 2018 at 14:08
  • did anyone find a soultion to this yet ? Commented Dec 17, 2018 at 11:03
  • Anyone found a solution for this? Commented Dec 6, 2019 at 11:43

3 Answers 3


I ran into this problem with a less file that was not empty but was just full of @var definitions so it was treated as empty, which is the same thing (doesn't create a .css file to merge). The fix is to put a css definition of any kind in the file.

Also couldn't just fix it, I had to go back into developer mode, clear cache, rebuild, and then back in production the deploy:static-content would work.

  • O, to be able to just fix things.
    – brackfost
    Commented Feb 13, 2019 at 13:56

Since I posted this, I noticed that deleting the empty styles.less file in my custom theme's css folder sometimes fixes issues similar to this one.

I can't recall if it was the fix for this particular issue, but if you have an empty styles.css file then it would be worth a shot.

  • 1
    Sometimes the error on why the compilation failed disappears because of that 'Cannot read contents from file' error. If you relaunch the deploy static content command, you will see the error message appear (usually it's due to a variable that is not defined in less or another less error so the style.less compilation failed and that's why it couldn't find the style.min.css)
    – Tofandel
    Commented Jul 18, 2018 at 14:49

It's not a common problem and it's can be for different case.

The best things will be if you debug.

Suppose in my case.




As that is on core so i did put try cache and got my solution.

For Example :

            'area' => $package->getArea(),
            'theme' => $package->getTheme(),
            'locale' => $package->getLocale(),
            'module' => $file->getModule(),

code changed to

            $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test-exception.log');
            $logger = new \Zend\Log\Logger();
            try {
                        'area' => $package->getArea(),
                        'theme' => $package->getTheme(),
                        'locale' => $package->getLocale(),
                        'module' => $file->getModule(),
            }catch (\Exception $exception) {
                $logger->info("Exception FOUND");

Then found my exception and --

In my case there was an unexpected symlink in my code and when it try to copy the error happen.

After fixing please revert the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.