将CakePHP安装从3.0.13升级到3.8

时间:2020-06-03 08:03:00

标签: cakephp composer-php migration cakephp-3.x

我的CakePHP 3.0.13安装正常。我想先升级到3.8,然后再跳到4.x分支。我启动了此命令:composer require cakephp/cakephp:3.8.12,然后得到下一个结果:

./composer.json has been updated
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
    - cakephp/migrations 1.3.2 requires cakephp/cakephp 3.0.* -> no matching package found.
    - cakephp/migrations 1.3.2 requires cakephp/cakephp 3.0.* -> no matching package found.
    - cakephp/migrations 1.3.2 requires cakephp/cakephp 3.0.* -> no matching package found.
    - Installation request for cakephp/migrations 1.3.2 -> satisfiable by cakephp/migrations[1.3.2].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

迁移软件包似乎存在依赖项问题:Cake需要对Migrations进行升级,但是Migrations需要Cake保持3.0。*。在vendor/cakephp/migrations/composer.json中,我有:

    ...
    "require": {
        "php": ">=5.4",
        "robmorgan/phinx": ">=0.4.2 <0.5.0",
        "cakephp/cakephp": "3.0.*"
    },
    ...

我也尝试过使用composer升级Migrations,但是却遇到了相反的问题:cakephp应该进行升级,所以我遇到了麻烦。有什么建议?提前谢谢!

1 个答案:

答案 0 :(得分:1)

我想我已经找到问题了。正如@ndm和@ Nico-haase指出的,我已经审查了composer.json文件。在其他软件包之间,我有: ... "cakephp/cakephp": "~3.0.13", "cakephp/migrations": "1.3.2", ... ...当我尝试将CakePHP升级到3.8.12时,我也应该升级了Migrations,因为Migrations 1.3.2运行在cake 3.0.13而不是3.8中。这就是为什么它不起作用。现在,我为Cake使用了3.8.12,为迁移仅使用了@stable

... "cakephp/cakephp": "~3.8.12", "cakephp/migrations": "@stable", ...

在还升级了平台要求(php版本,libs等)之后,我成功启动了composer install。非常感谢!