3
php -f magento setup:static-content:deploy

While running this command after making css changes in the theme file of the magento 2 I got the below error

ubuntu@tlttvmd42:/opt/lampp/htdocs/ecom/bin$ php -f magento setup:static-content:deploy
PHP Fatal error:  Uncaught Error: Call to undefined function Composer\Json\json_decode() in /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Json/JsonFile.php:152
Stack trace:
#0 /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Factory.php(269): Composer\Json\JsonFile->validateSchema(1)
#1 /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Factory.php(532): Composer\Factory->createComposer(Object(Composer\IO\BufferIO), '/opt/lampp/htdo...', false)
#2 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerFactory.php(47): Composer\Factory::create(Object(Composer\IO\BufferIO), '/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerInformation.php(362): Magento\Framework\Composer\ComposerFactory->create()
#4 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerInformation.php(375): Magento\Framework\Composer\ComposerInformation->getComposer()
#5 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerInformation.php(242): Magento\F in /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Json/JsonFile.php on line 152

And I googled it and there are some suggestion to install Php json and I found in the phpinfo Json is already enabled

I used the suggessted command to install the json

sudo apt-get install php-json

Once installing I restarted the Lampp and i tried to deploy the static Magento command and I still face the same issue, Any help would be appreciated. Thanks in advance.

I use Ubutu Os and Lampp server

  • try this sudo php bin/magento setup:static-content:deploy – Magento 2 Aug 11 '17 at 7:36
  • try this command php bin/magento setup:static-content:deploy – Abhishek Tripathi Aug 11 '17 at 8:06
  • try this command php bin/magento setup:static-content:deploy, but you do not have to be in the "bin" folder, you to be in Magento root folder – St3phan Aug 11 '17 at 8:46
  • i tried the below command as you mentioned above inside the magento root folder ubuntu@tlttvmd42:/opt/lampp/htdocs/ecom$ php bin/magento setup:static-content:deploy , But i still face the above mentioend error – user1579026 Aug 11 '17 at 9:03
0

You try this sudo php bin/magento setup:static-content:deploy after no any error solve your var folder remove it and after this command try it.

0

I Solved this issue by uninstalling multiple PHP versions and reinstall fresh PHP 7 version and the above command now working fine, Thankyou all for the sugesstions.

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.