5

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}


  [Magento\Framework\Exception\FileSystemException]                                                                           
  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.

Thanks!

  • 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 Jan 10 '18 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 Jan 13 '18 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 Jan 16 '18 at 14:08
  • did anyone find a soultion to this yet ? – Sarasranglt Dec 17 '18 at 11:03
1

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 Feb 13 at 13:56
0

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 Jul 18 '18 at 14:49

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.