Struggling to update or do anything with composer and get the same error every time:

  "./composer.json" does not contain valid JSON
  Parse error on line 15:
        "phpunit     ": {re
  Expected one of: 'STRING', '}'

Any help would be much appreciated.

1 Answer 1


It's not the fault of PHPUnit, but your composer.json is broken. As the error message tells you,

"phpunit     ": {re
         here is the error

Actually, the whole line and probably more after it is invalid. The package name for PHPUnit is "phpunit/phpunit" and not "phpunit " and {re (and whatever follows) is not even close to a version constraint which is expected here (like "4.1.0")

Since you did not show your composer.json, I can only guess that you accidently deleted a part of the file.

Compare it with this one: https://github.com/magento/magento2/blob/develop/composer.json

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.