我有一个作曲家文件,其中包含需要 PHP>= 5.4.0 的开发依赖项。 当我更新生产环境(5.3 安装(是的 - 我知道!))并显式传递 --no-dev
选项时,作曲家仍然会检查开发包中的 PHP 版本要求。
作曲家文件:
{
"config": {
"vendor-dir": "./vendor/"
},
"require": {
"symfony/config" : "dev-master",
"twig/twig": "1.15.1",
"leafo/lessphp": "v0.4.0",
"simplepie/simplepie": "dev-master",
"contao/idna": "dev-master",
"swiftmailer/swiftmailer": "5.3.*@dev",
"james-heinrich/getid3": "dev-master",
"pda/pheanstalk": "v2.1.0",
"monolog/monolog": "1.9.1",
"pimple/pimple": ">1.0.0",
"doctrine/orm": "2.4.*",
"ircmaxell/password-compat": "1.0.3",
"raven/raven": "dev-curl-async",
"elasticsearch/elasticsearch": "~1.0",
"guzzle/guzzle": "3.9.2"
},
"require-dev": {
"codeception/codeception": "2.1.*@dev"
}
}
Codeception
对 PHP 5.4.0+ 有要求,当我运行composer update --no-dev
时,我得到以下内容:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for codeception/codeception 2.1.*@dev -> satisfiable by codeception/codeception[2.1.x-dev].
- codeception/codeception 2.1.x-dev requires php >=5.4.0 -> no matching package found.
作曲家是否应该跳过我明确告诉它不要安装的软件包的需求检查? 我曾尝试过通过--ignore-platform-reqs
但没有成功。
更新
似乎在 PHP 5.3.10 上运行它完全忽略了--no-dev
选项并报告它正在安装它们:
composer update --no-dev
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for codeception/codeception 2.1.*@dev -> satisfiable by codeception/codeception[2.1.x-dev].
- codeception/codeception 2.1.x-dev requires php >=5.4.0 -> no matching package found.
您需要使用 --no-dev
来不安装开发包。
已解决!!
看来我的composer
文件是一个 bash 脚本,没有将参数正确传递给composer.phar
文件。
这个问题是我自己造成的。