我的composer.json文件出了什么问题?

时间:2017-08-25 15:20:16

标签: json composer-php

我收到作曲家错误,我不明白错误。 json文件对我来说很好。

  [Seld\JsonLint\ParsingException]
 "./composer.json" does not contain valid JSON
 Parse error on line 88:
 ...]        }        "patches": {
 --------------------^
 Expected one of: 'EOF', '}', ',', ']'

下面的要点中的composer.json

https://gist.github.com/MrPaulDriver/89d6573e654815d75368cae121076acb

1 个答案:

答案 0 :(得分:1)

您在,部分之前缺少patches,请调整为:

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0+",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal-composer/drupal-scaffold": "^2.2",
        "drupal/admin_toolbar": "^1.19",
        "drupal/block_class": "1.x-dev",
        "drupal/coffee": "1.x-dev",
        "drupal/console": "~1.0",
        "drupal/core": "~8.0",
        "drupal/devel": "1.x-dev",
        "drupal/ds": "^3.1",
        "drupal/easy_breadcrumb": "^1.6",
        "drupal/field_group": "3.x-dev",
        "drupal/flexslider": "2.x-dev",
        "drupal/google_analytics": "^2.1",
        "drupal/metatag": "^1.1",
        "drupal/neato": "^1.6",
        "drupal/pathauto": "^1.0",
        "drupal/responsive_menu": "^2.4",
        "drupal/smart_trim": "1.x-dev",
        "drupal/token": "^1.0",
        "drush/drush": "~8.0",
        "webflo/drupal-finder": "^0.3.0",
        "webmozart/path-util": "^2.3"
    },
    "require-dev": {
        "behat/mink": "~1.7",
        "behat/mink-goutte-driver": "~1.2",
        "jcalderonzumba/gastonjs": "~1.0.2",
        "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
        "mikey179/vfsstream": "~1.2",
        "phpunit/phpunit": ">=4.8.28 <5",
        "symfony/css-selector": "~2.8"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
      "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        },
        "patches": {
            "drupal/responsive_menu": {
                "Disable keyboard input": "https://www.drupal.org/files/issues/off_canvas_menu-2826965-11.patch"
            }
        }
    }
}

注意您可能希望使用类似https://jsonlint.com的内容或适当的IDE,以便在JSON文件出现问题时通知您。