CakeDC Users Plugin Composer 安装

CakeDC Users Plugin Composer installation

我正在使用 CakePHP 3.6.2 并尝试使用 Composer 安装 CakeDC Users 插件,但出现以下错误消息:

Using version ^7.0 for cakedc/users
./composer.json has been created
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 cakedc/users ^7.0 -> satisfiable by cakedc/users[7.0.0].
    - cakedc/users 7.0.0 requires cakephp/cakephp ^3.6 -> satisfiable by cakephp/cakephp[3.6.0, 3.6.1, 3.6.2].
    - cakephp/cakephp 3.6.0 requires aura/intl ^3.0.0 -> satisfiable by aura/intl[3.0.0].
    - cakephp/cakephp 3.6.1 requires aura/intl ^3.0.0 -> satisfiable by aura/intl[3.0.0].
    - cakephp/cakephp 3.6.2 requires aura/intl ^3.0.0 -> satisfiable by aura/intl[3.0.0].
    - Conclusion: don't install aura/intl 3.0.0


Installation failed, deleting ./composer.json.

谁能告诉我如何解决这个问题,同时仍然使用 Composer 安装?

我的composer.json:


{
    "name": "cakephp/app",
    "description": "CakePHP skeleton app",
    "homepage": "https://cakephp.org",
    "type": "project",
    "license": "MIT",
    "require": {
        "php": ">=5.6",
        "cakephp/cakephp": "3.6.*",
        "cakephp/migrations": "^1.8.0",
        "cakephp/plugin-installer": "^1.0",
        "josegonzalez/dotenv": "3.*",
        "mobiledetect/mobiledetectlib": "2.*"
    },
    "require-dev": {
        "cakephp/bake": "^1.1",
        "cakephp/cakephp-codesniffer": "^3.0",
        "cakephp/debug_kit": "^3.15.0",
        "psy/psysh": "@stable"
    },
    "suggest": {
        "markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
        "dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan compatibility.",
        "phpunit/phpunit": "Allows automated tests to be run without system-wide install."
    },
    "autoload": {
        "psr-4": {
            "App\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\Test\": "tests/",
            "Cake\Test\": "vendor/cakephp/cakephp/tests/"
        }
    },
    "scripts": {
        "post-install-cmd": "App\Console\Installer::postInstall",
        "post-create-project-cmd": "App\Console\Installer::postInstall",
        "post-autoload-dump": "Cake\Composer\Installer\PluginInstaller::postAutoloadDump",
        "check": [
            "@test",
            "@cs-check"
        ],
        "cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
        "cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
        "test": "phpunit --colors=always"
    },
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    }
}

从 CakeDC installation docs,您需要 运行 composer require cakedc/users

您需要 运行 将此文件与您的 composer.json 文件放在同一目录中。您的错误消息显示 ./composer.json has been created。如果你在正确的目录中 运行 它会说 ./composer.json has been updated

或者,您可以手动将 "cakedc/users": "^7.0" 添加到 composer.json 中所需的包中,然后 运行 composer install

"require": {
    "php": ">=5.6",
    "cakephp/cakephp": "3.6.*",
    "cakephp/migrations": "^1.8.0",
    "cakephp/plugin-installer": "^1.0",
    "josegonzalez/dotenv": "3.*",
    "mobiledetect/mobiledetectlib": "2.*",
    "cakedc/users": "^7.0"                 <- Add this line
},

我刚刚测试了您发布的 composer.json 文件,它工作正常(composer 安装)。您是在新环境中设置此项目吗?

  • 检查是否安装了所有 CakePHP 要求,例如 php-intl 扩展
  • 删除 vendor 文件夹并运行 composer 重新安装