We just got a fresh new Magento 2.4.6 p3 CE version installed.
So we do want to install some extensions starting with these module:
composer require mageplaza/module-core
`In JsonFile.php line 347:
"./composer.json" does not contain valid JSON
Parse error on line 79:
…s": [{ ,"http-basic": {
Expected one of: ‘STRING’, ‘}’
`
We get this error at CLI
Apparently, my composer.json file got an error. Below details on our file.
Please explain for me how to fix it. Thanks!
{
"name": "magento/project-community-edition",
"description": "eCommerce Platform for Growth (Community Edition)",
"type": "project",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"laminas/laminas-dependency-plugin": true,
"magento/*": true,
"php-http/discovery": true
},
"preferred-install": "dist",
"sort-packages": true
},
"version": "2.4.6-p3",
"require": {
"magento/product-community-edition": "2.4.6-p3",
"magento/composer-dependency-version-audit-plugin": "~0.1",
"magento/composer-root-update-plugin": "~2.0"
},
"autoload": {
"exclude-from-classmap": [
"**/dev/**",
"**/update/**",
"**/Test/**"
],
"files": [
"app/etc/NonComposerComponentRegistration.php"
],
"psr-0": {
"": [
"app/code/",
"generated/code/"
]
},
"psr-4": {
"Magento\": "app/code/Magento/",
"Magento\Framework\": "lib/internal/Magento/Framework/",
"Magento\Setup\": "setup/src/Magento/Setup/"
}
},
"require-dev": {
"allure-framework/allure-phpunit": "^2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"dg/bypass-finals": "^1.4",
"friendsofphp/php-cs-fixer": "^3.8",
"lusitanian/oauth": "^0.8",
"magento/magento-coding-standard": "*",
"magento/magento2-functional-testing-framework": "^4.3.1",
"pdepend/pdepend": "^2.10",
"phpmd/phpmd": "^2.12",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^9.5",
"sebastian/comparator": "<=4.0.6",
"sebastian/phpcpd": "^6.0",
"symfony/finder": "^5.4",
"symfony/process": "<=v5.4.23"
},
"conflict": {
"gene/bluefoot": "*"
},
"autoload-dev": {
"psr-4": {
"Magento\PhpStan\": "dev/tests/static/framework/Magento/PhpStan/",
"Magento\Sniffs\": "dev/tests/static/framework/Magento/Sniffs/",
"Magento\TestFramework\Inspection\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
"Magento\TestFramework\Utility\": "dev/tests/static/framework/Magento/TestFramework/Utility/",
"Magento\Tools\": "dev/tools/Magento/Tools/",
"Magento\Tools\Sanity\": "dev/build/publication/sanity/Magento/Tools/Sanity/"
}
},
"minimum-stability": "stable",
"prefer-stable": true,
{
"repositories": [
{
,"http-basic": {
"repo.magento.com": {
"username": "<your public key>",
"password": "<your private key>"
}
}
}
{
,"mageplaza": {
"repo.mageplaza.com": {
"username": "<your mageplaza public key>",
"password": "<your mageplaza private key>"
}
}
}
}
],
"extra": {
"magento-force": "override"
}
}
2
Answers
Here is your composer.json, you added multiples parenthesis and commas wich were not correct :
It looks like there are some syntax errors in your composer.json file. Specifically, there are extra commas and missing braces in the "repositories" section. Here’s a corrected version of your composer.json file:
Make sure to add "mageplaza/module-core": "*" to the "require" section if you want to install the Mageplaza module-core. After making these changes, try running the composer require command again.