composer.lock中的symfony / var-dumper问题

时间:2018-11-21 13:53:17

标签: php symfony composer-php

启动composer.lock时,我的composer install遇到了问题。

我有一个错误:

  

symfony / var-dumper v4.0.12的安装请求-> symfony / var-dumper [v4.0.12]可以满足。

所以我从composer.lock中删除了它:

{
    "name": "symfony/var-dumper",
    "version": "v4.0.12",
    "source": {
        "type": "git",
        "url": "https://github.com/symfony/var-dumper.git",
        "reference": "f670984c74fa1e92e68c6e50fe9eebc3fc4d1923"
    },
    "dist": {
        "type": "zip",
        "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f670984c74fa1e92e68c6e50fe9eebc3fc4d1923",
        "reference": "f670984c74fa1e92e68c6e50fe9eebc3fc4d1923",
        "shasum": ""
    },
    "require": {
        "php": "^7.1.3",
        "symfony/polyfill-mbstring": "~1.0",
        "symfony/polyfill-php72": "~1.5"
    },
    "conflict": {
        "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
    },
    "require-dev": {
        "ext-iconv": "*",
        "twig/twig": "~1.34|~2.4"
    },
    "suggest": {
        "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
        "ext-intl": "To show region name in time zone dump"
    },
    "type": "library",
    "extra": {
        "branch-alias": {
            "dev-master": "4.0-dev"
        }
    },
    "autoload": {
        "files": [
            "Resources/functions/dump.php"
        ],
        "psr-4": {
            "Symfony\\Component\\VarDumper\\": ""
        },
        "exclude-from-classmap": [
            "/Tests/"
        ]
    },
    "notification-url": "https://packagist.org/downloads/",
    "license": [
        "MIT"
    ],
    "authors": [
        {
            "name": "Nicolas Grekas",
            "email": "p@tchwork.com"
        },
        {
            "name": "Symfony Community",
            "homepage": "https://symfony.com/contributors"
        }
    ],
    "description": "Symfony mechanism for exploring and dumping PHP variables",
    "homepage": "https://symfony.com",
    "keywords": [
        "debug",
        "dump"
    ],
    "time": "2018-06-15 07:52:13"
}

一切都可以在composer install命令中进行!

所以,问题是.....为什么将其放在composer.lock上时出现此问题?是否删除它是一个好习惯?我可以用其他解决方案解决吗?

注意:我使用PHP7.1.17和Symfony3.3。

1 个答案:

答案 0 :(得分:0)

您不应更改composer.lock文件的内容。您只需将version constraints设置在composer.json上,并使用composer install,让作曲家为您解决依赖关系。

composer.lock是由作曲家自动创建的,应保持不变。

如果您在composer.lock上遇到问题并且正在自己开发(没有任何合作者),则可以简单地删除composer.lock文件并再次运行composer install