当我启动
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": "[email protected]"
},
{
"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。
您不应该更改
composer.lock
文件的内容。您只需在 composer.json
上设置您的 版本约束,然后使用
composer install
,您就可以让 Composer 为您解决依赖关系。
composer.lock
由作曲家自动创建,您应该保持不变。
如果您在
composer.lock
方面遇到问题,并且您正在自己开发(您没有任何协作者),那么您只需删除 composer.lock
文件并再次运行 composer install
即可。
不建议直接编辑composer.lock,因为它会在下一个构建时再次更改。
幸运的是他们撤回了它 https://github.com/advisories/GHSA-cg28-v4wq-whv5