Laravel 9发现了照明/合同,但没有加载,这可能是因为它与另一个要求冲突

发布于 2025-02-05 19:34:23 字数 2543 浏览 1 评论 0原文

我有一个空白的Laravel 9安装。唯一添加的扩展名是Jetstream和Livewire。我正在尝试安装Spatie/Laravel-Comments软件包,但是我会收到以下错误。

您的要求无法解决到可安装的一组 软件包。

问题1 - root Composer.json需要Spatie/laravel -comments ^0.0.2 - >可以通过Spatie/laravel-comments满足[0.0.2]。 - Spatie/laravel -comments 0.0.2需要照明/合同 ^8.73 - >找到照明/合同[v8.73.0,...,8.x-dev]但是这些 没有加载,可能是因为它与另一个要求发生冲突。

您也可以尝试使用明确版本的重新运行作曲家要求 约束,例如,“作曲家需要嘲讽/拉拉维尔·科姆斯:*” 找出是否可以安装任何版本,或者“作曲家需要 Spatie/laravel-comments:^2.1“如果您知道您需要哪个。

安装失败,恢复./composer.json和./composer.lock to 他们的原始内容。

如果我指定要安装的版本或将其打开以获取最新版本,也会发生同样的错误。我尝试删除composer.lock文件并重新安装所有内容,我的composer.json看起来像。

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.11",
        "laravel/jetstream": "^2.8",
        "laravel/sanctum": "^2.14.1",
        "laravel/tinker": "^2.7",
        "livewire/livewire": "^2.10"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

我正在使用的版本是:

Composer -v = 2.4

php -v -v 8.1.3

,我在Windows上

I have a blank Laravel 9 install. The only extensions added are jetstream and livewire. I am trying to install spatie/laravel-comments package, but I get the following error.

Your requirements could not be resolved to an installable set of
packages.

Problem 1
- Root composer.json requires spatie/laravel-comments ^0.0.2 -> satisfiable by spatie/laravel-comments[0.0.2].
- spatie/laravel-comments 0.0.2 requires illuminate/contracts ^8.73 -> found illuminate/contracts[v8.73.0, ..., 8.x-dev] but these
were not loaded, likely because it conflicts with another require.

You can also try re-running composer require with an explicit version
constraint, e.g. "composer require spatie/laravel-comments:*" to
figure out if any version is installable, or "composer require
spatie/laravel-comments:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to
their original content.

The same error occurs if I specify a version to install or leave it open for latest. I have tried removing the composer.lock file and reinstalling everything, my composer.json looks like.

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.11",
        "laravel/jetstream": "^2.8",
        "laravel/sanctum": "^2.14.1",
        "laravel/tinker": "^2.7",
        "livewire/livewire": "^2.10"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Versions I'm using are:

composer -v = 2.4

php -v 8.1.3

and I'm on Windows

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

用心笑 2025-02-12 19:34:23

我曾经遇到过一次这个问题,我认为您需要运行此命令只

composer update

希望这可以解决。

对于Spatie安装,您可以在此处找到所有内容 spatie安装

I've faced this issue once, and i think you need to run this command only

composer update

Hope this will fix.

and for Spatie installation you can find everything here SPATIE Installation

感情废物 2025-02-12 19:34:23

如您在 Package的Packagist概述,该包与Laravel 9不兼容, 。但这不是该软件包的最大问题:Github不再可用,因此下载代码可能会失败。

您应该使用其他适合您需求的软件包,或与维护人员联系。也许Spatie会重新发布它,并使其与Laravel 9兼容?

As you can see on the package's packagist overview, the package is not compatible with Laravel 9. But that is not the largest problem of that package: it is no longer available on Github, so downloading the code might fail.

You should use any other package that suits your needs, or contact the maintainers. Maybe Spatie will re-publish it, and make it compatible with Laravel 9?

2025-02-12 19:34:23

我经历了这一点,当我尝试运行作曲家更新时,问题保持不变,但是我试图仔细阅读错误日志,有一个解释说,钠扩展未加载或没有加载给定的访问,在php.ini配置文件中打开扩展访问,然后我直接去那里,省略了“”; (称为评论的标语)在说;钠和结果奏效的线上,我希望这对与我遇到相同问题的人很有用。

php.ini

I experienced this, when I tried to run composer update, the problem remained the same, but I tried to read the error log carefully, there was an explanation that said the sodium extension was not loaded or was not given access, open extension access in the php.ini configuration file, then I went straight there, omitting the ";" (as a sign called comment) on the line that says ;sodium, and the result worked, I hope this is useful for those who experience the same problem as me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文