由于Zend一直在不断发布其核心软件包的ZF3版本,我在使用旧的ZF2应用程序时遇到了问题。
如果我使用有效的composer.lock运行composer install
,我会收到大多数ZF依赖项的后续警告:
- Installing zendframework/zend-stdlib (2.7.7)
Downloading: 100%
Failed to download zendframework/zend-stdlib from dist: The checksum verification of the file failed (downloaded from https://packages.zendframework.com/composer/zendframework-zend-stdlib-2.7.7-19d9a4.zip)
Now trying to download from source
- Installing zendframework/zend-stdlib (2.7.7)
Cloning baa65aec7bc75260254b5f03447f0c16360f9e59
由于我有很多这样的依赖,因此安装/克隆需要永远而且永远不会完成,导致我的虚拟机耗尽内存。
现在我尝试运行composer update
或删除composer.lock并再次运行composer install
。我甚至尝试从composer.json中删除packages.zendframework.com repo,因为Zend说,它不再需要了。
然而,由于新的ZF3版本,我得到了无法解决的要求。
示例:
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
- jhuet/zdt-logger-module dev-master requires zendframework/zend-developer-tools ^1.1.0 -> satisfiable by zendframework/zend-developer-tools[1.2.x-dev, 1.1.x-dev].
- Can only install one of: zendframework/zend-developer-tools[dev-master, 1.2.x-dev].
- Conclusion: don't install zendframework/zend-servicemanager 2.7.7
- Conclusion: don't install zendframework/zend-servicemanager 3.1.1
- Conclusion: don't install zendframework/zend-servicemanager 3.1.0
- Installation request for zendframework/zend-developer-tools dev-master -> satisfiable by zendframework/zend-developer-tools[dev-master].
- Conclusion: don't install zendframework/zend-servicemanager 2.7.6|install zendframework/zend-servicemanager 3.1.0
- Installation request for zfcampus/zf-apigility-admin ~1.0 -> satisfiable by zfcampus/zf-apigility-admin[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7].
- Installation request for jhuet/zdt-logger-module dev-master -> satisfiable by jhuet/zdt-logger-module[dev-master].
- Installation request for zf-commons/zfc-rbac ~2.0 -> satisfiable by zf-commons/zfc-rbac[2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.4.2, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6].
- jhuet/zdt-logger-module dev-master requires zendframework/zend-servicemanager 3.* -> satisfiable by zendframework/zend-servicemanager[3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0, 3.1.1].
- Can only install one of: zendframework/zend-servicemanager[3.0.0, 2.7.5].
- Can only install one of: zendframework/zend-servicemanager[3.0.1, 2.7.5].
- Can only install one of: zendframework/zend-servicemanager[3.0.2, 2.7.5].
- zendframework/zend-developer-tools 1.1.x-dev requires zendframework/zend-servicemanager ^2.7.5 || ^3.0.3 -> satisfiable by zendframework/zend-servicemanager[2.7.5, 2.7.6, 2.7.7, 3.0.3, 3.1.0, 3.1.1].
- Conclusion: don't install zendframework/zend-servicemanager 3.0.3
后果:我无法让我的ZF2应用程序进入工作状态了。我该如何解决这个问题?
这是我的composer.json:
{
"name": "myapp",
"description": "My app",
"version": "1.5.0",
"require": {
"php": "~7.0",
"ext-intl": ">=1.1.0",
"ext-mbstring": "*",
"zendframework/zendframework": "~2.5",
"zf-commons/zfc-user": "~1.0",
"zf-commons/zfc-rbac": "~2.0",
"zendframework/zendoauth": "~2.0",
"zfcampus/zf-apigility": "~1.0",
"zfcampus/zf-development-mode": "~2.0",
"aws/aws-sdk-php-zf2": "~2.0",
"goalio/goalio-forgotpassword": "~1.0",
"maglnet/magl-markdown": "~1.4",
"ocramius/proxy-manager": "~1.0"
},
"require-dev": {
"zfcampus/zf-apigility-admin": "~1.0",
"zfcampus/zf-apigility-documentation": "~1.0",
"zendframework/zend-developer-tools": "dev-master",
"jhuet/zdt-logger-module": "dev-master",
"bjyoungblood/bjy-profiler": "dev-master"
}
}
我希望,这可以通过某种方式解决,而无需大量的手工工作。
答案 0 :(得分:2)
当您需要dev-master之类的东西时,可能会遇到这些问题。最好的做法是坚持使用语义版本号,如果软件包维护者遵循语义版本控制,那么您就不应该遇到需要打破更改的软件包。
在您的情况下,您依赖于" jhuet / zdt-logger-module"的开发主版本。最近更新了这个以支持ZF3。如果您删除"jhuet/zdt-logger-module": "dev-master",
,它似乎对我有效。
要保留该套餐,您需要:"jhuet/zdt-logger-module": "^0.3"
。这确保它不会加载需要ZF3的较新的1.0.0包。