Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BOM error, input not detected error

This is my JSON

{
    "name": "dockerizing-magento",
    "description": "ADockerizedMagentoCommunityEdition",
    "require": {
        "magento-hackathon/magento-composer-installer": "v2.1.1",
        "magento/core": "1.9.1.0-patch1"
    },
    "require-dev": {},
    "repositories": [],
    "extra": {
        "magento-root-dir": "web",
        "auto-append-gitignore": true
    },
    "config": {
        "discard-changes": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-install-cmd": [],
        "post-update-cmd": []
    }
}

When i try to composer update

it gives error of

[Seld\JsonLint\ParsingException]
"./composer.json" does not contain valid JSON
BOM detected, make sure your input does not include a Unicode Byte-Order-Mark

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] []...

but it is valid according to several websites

https://jsonformatter.curiousconcept.com/

for example here

I follow this tutorial

https://andykdocs.de/development/Docker/Dockerize-Magento

But for hours, i got this error. Please help

I try to build a magento inside docker.

like image 683
fff Avatar asked Apr 06 '26 22:04

fff


1 Answers

The Byte Order Mark (BOM for short) is something that only exists in a file. When an editor or text viewer renders your composer.json, it removes the BOM, So if you paste the contents of composer.json into a web based linter, it won't have the BOM anymore and so web based tools that you're pasting into, will validate it. What you should do is remove the BOM from the file which you can do with an awk command that I borrowed from this answer

mv composer.json composer-bom.json # rename file with BOM
awk 'NR==1{sub(/^\xef\xbb\xbf/,"")}{print}' composer-bom.json > composer.json
rm -f composer-bom.json # delete file with BOM
like image 160
Asaph Avatar answered Apr 08 '26 10:04

Asaph



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!