【问题标题】:Upgrade CakePHP install from 3.0.13 to 3.8将 CakePHP 安装从 3.0.13 升级到 3.8
【发布时间】:2020-06-03 08:03:00
【问题描述】:

我已经安装了 CakePHP 3.0.13。在尝试跳转到 4.x 分支之前,我想升级到 3.8。我已经启动了这个: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 升级迁移,但我遇到了相反的问题:cakephp 应该升级,所以我被卡住了。有什么建议么?提前谢谢!

【问题讨论】:

  • 一次升级所有依赖,不是一个一个。如果仍然存在问题,请删除 vendor 文件夹和 composer.lock 文件,即使所有依赖项都应该兼容。
  • 我已删除 vendor/*composer.lock。然后我用"cakephp/cakephp": "3.8.12", 编辑了composer.json 并启动了composer install。我有同样的结果(除了关于 PHP 版本的其他人):-Installation request for cakephp/migrations 1.3.2 -&gt; satisfiable by cakephp/migrations[1.3.2]. - - cakephp/migrations 1.3.2 requires cakephp/cakephp 3.0.* -&gt; no matching package found.
  • 如前所述,一次升级 所有 依赖项,需要兼容 CakePHP、Migrations 以及应用程序 composer.json 中的任何其他依赖项的兼容版本。跨度>
  • 你能分享你自己的 composer.json吗?其他包需要的任何东西都可能不那么相关

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


【解决方案1】:

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

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

在升级了平台要求(php 版本、库、...)之后,我已经成功启动了composer install。非常感谢!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-12
    • 1970-01-01
    • 2020-06-17
    • 2020-02-22
    • 2021-10-05
    • 2012-03-17
    相关资源
    最近更新 更多