首页 > 解决方案 > Invalid version string "*"

问题描述

Here is the line that causes the issue:

"config": {
    "platform": {
        "ext-calendar": "*"
    }
},

And on composer update it results in a Invalid version string "*"

Composer version: 1.9.3

Tried to remove the vendor and re-install everything, but same results.

标签: phpcomposer-php

解决方案


在您的 composer.json 中,您可以将平台添加到您的配置中,以强制它解析对特定 PHP 版本的依赖关系。

https://getcomposer.org/doc/06-config.md#platform

"config": {
    "platform": {
        "php": "5.6"
    },
},

例如,如果您的开发机器的 PHP 版本与您的实际服务器不同,则使用此平台密钥,以便 composer 将依赖关系解析为特定版本。这意味着*在这里没有任何意义。此外,这是一个 PHP 扩展,而不是 PHP 版本,所以它只属于正常的 require 部分,其中 a*被接受。

要么删除该部分,要么锁定一个实际的 PHP 号码,你应该很高兴。


推荐阅读