The follwing error occurs during the command php bin/magento setup:static-content:deploy en_US de_DE execution, but the command continues to work.

"Error : vendor/tedivm/jshrink/src/JShrink/Minifier"

It's in production mode

How to fix it?

#0 vendor/tedivm/jshrink/src/JShrink/Minifier.php(231): JShrink\Minifier->saveString()
#1 vendor/tedivm/jshrink/src/JShrink/Minifier.php(144): JShrink\Minifier->loop()
#2 vendor/tedivm/jshrink/src/JShrink/Minifier.php(110): JShrink\Minifier->minifyDirectToOutput('"no use strict"...', Array)
#3 vendor/magento/framework/Code/Minifier/Adapter/Js/JShrink.php(27): JShrink\Minifier::minify('"no use strict"...')
#4 vendor/magento/framework/View/Asset/PreProcessor/Minify.php(50): Magento\Framework\Code\Minifier\Adapter\Js\JShrink->minify('"no use strict"...')
#5 vendor/magento/framework/View/Asset/PreProcessor/Pool.php(77): Magento\Framework\View\Asset\PreProcessor\Minify->process(Object(Magento\Framework\View\Asset\PreProcessor\Chain))
#6 vendor/magento/framework/View/Asset/Source.php(152): Magento\Framework\View\Asset\PreProcessor\Pool->process(Object(Magento\Framework\View\Asset\PreProcessor\Chain))
#7 vendor/magento/framework/View/Asset/Source.php(105): Magento\Framework\View\Asset\Source->preProcess(Object(Magento\Framework\View\Asset\File))
#8 vendor/magento/framework/View/Asset/File.php(157): Magento\Framework\View\Asset\Source->getFile(Object(Magento\Framework\View\Asset\File))
#9 vendor/magento/framework/App/View/Asset/Publisher.php(73): Magento\Framework\View\Asset\File->getSourceFile()
#10 vendor/magento/framework/App/View/Asset/Publisher.php(61): Magento\Framework\App\View\Asset\Publisher->publishAsset(Object(Magento\Framework\View\Asset\File))
vendor/magento/module-deploy/Service/DeployStaticFile.php(89): Magento\Framework\App\View\Asset\Publisher->publish(Object(Magento\Framework\View\Asset\File))
vendor/magento/module-deploy/Service/DeployPackage.php(185): Magento\Deploy\Service\DeployStaticFile->deployFile('js/lib/ace/work...', Array)
vendor/magento/module-deploy/Service/DeployPackage.php(132): Magento\Deploy\Service\DeployPackage->processFile(Object(Magento\Deploy\Package\PackageFile), Object(Magento\Deploy\Package\Package))
#14 vendor/magento/module-deploy/Service/DeployPackage.php(103): Magento\Deploy\Service\DeployPackage->deployEmulated(Object(Magento\Deploy\Package\Package), Array, false)
#15 [internal function]: Magento\Deploy\Service\DeployPackage->Magento\Deploy\Service\{closure}()
  • Disable minify from admin and try again. – Nikunj Vadariya Jul 3 '18 at 10:15
  • it work or not? – Nikunj Vadariya Jul 3 '18 at 10:26
  • I do not need to disable these settings – Evgeniy Kapelko Jul 3 '18 at 12:48
  • Hi Evgeniy Kapelko , Did you found the solution ? – Raghav Oct 15 '18 at 14:14
  • Hi, the problem was solved by itself, I can not say what it was connected with. – Evgeniy Kapelko Oct 15 '18 at 17:59

Workaround, downgrade to version 1.3.1

composer require "tedivm/jshrink:1.3.1"
| improve this answer | |
  • Thank you. Worked for me on Magento 2.2.5. Faced this issue when switched to production. Used your solution and it deploys smoothly now. Excellent. – Mohammed Joraid Jul 13 '19 at 0:37

It has now been fixed in the version 1.3.3 released in June 28th.

Update the module with the following command :

composer update tedivm/jshrink
| improve this answer | |

Still broken for me on Magento 2.2.6 with jshrink 1.3.3 with all third party extensions disabled. Any tips on how to debug?


What I've done for now to get things working is just commented out the error output on line 529 of vendor/tedivm/jshrink/src/JShrink/Minifier.php

The commented line looks like the following:

//throw new \RuntimeException('Unclosed regex pattern at position: ' . $this->index);

Now it seems to be minifying both CSS and JS successfully where before when it was throwing the error it wasn't.

| improve this answer | |

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.