Composer – 安装/更新 Laravel 经典的 Spark 无法正常运行

huangapple go评论64阅读模式
英文:

Composer - installing/updating Laravel classic spark doesn't work

问题

The lower version is not updated because your Laravel project's composer.json specifies a minimum version constraint for "laravel/spark-aurelius" as "~11.0," which means it can accept versions equal to or higher than 11.0 but not lower. The "laravel/spark-aurelius" version "10.x-dev" that is found does not meet this constraint, as it's a lower version.

To allow a lower version to be installed, you need to modify your composer.json file to specify a less restrictive version constraint. For example, you can change the version constraint to accept any version like this:

"laravel/spark-aurelius": "*"

This will allow Composer to install any available version of "laravel/spark-aurelius," including the "10.x-dev" version. After making this change, you can run composer update again, and it should update to the lower version if it's available.

英文:

It has been some time since I did work for my Laravel website, which is running the classic Spark plugin (https://spark-classic.laravel.com/). I am trying to set things up in my Windows WSL2 environment but running into some issues when running composer update.

First of all, the original composer.json contains: "laravel/spark-aurelius": "*@dev",

$ composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/spark-aurelius[dev-master, 10.x-dev] require php ^7.2 -> your php version (8.1.2) does not satisfy that requirement.
    - laravel/spark-aurelius 10.x-dev is an alias of laravel/spark-aurelius dev-master and thus requires it to be installed too.
    - Root composer.json requires laravel/spark-aurelius *@dev -> satisfiable by laravel/spark-aurelius[dev-master, 10.x-dev (alias of dev-master)].

After inspecting the Spark installation website (https://spark-classic.laravel.com/docs/12.0/installation) I noticed the latest Spark package required this

"laravel/spark-aurelius": "~11.0",

So I changed that in the composer.json file. However, after running composer update

$ composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires laravel/spark-aurelius ~11.0, found laravel/spark-aurelius[dev-master, 10.x-dev (alias of dev-master)] but these do not match your constraint and are therefore not installable. Make sure you either fix the constraint or avoid updating this package to keep the one present in the lock file (laravel/spark-aurelius[v11.0.4]).

So I am not sure what to make of it. The problem indicates that although version ~11.0 is specified in the composer.json, a lower version 10.x-dev was found.

This is the complete composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.2.5|^8.0",
        "aws/aws-sdk-php-laravel": "^3.6",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "graham-campbell/flysystem": "^7.1",
        "guzzlehttp/guzzle": "^6.3.1|^7.0.1",
        "laravel/framework": "^7.29",
        "laravel/spark-aurelius": "~11.0",
        "laravel/tinker": "^2.5",
        "laravel/ui": "^2.0",
        "laravelcollective/html": "^6.2",
        "league/flysystem-aws-s3-v3": "^1.0",
        "mpociot/vat-calculator": "^2.4",
        "shiftonelabs/laravel-sqs-fifo-queue": "^2.0",
        "uxweb/sweet-alert": "^2.0"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fakerphp/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.3",
        "phpunit/phpunit": "^8.5.8|^9.3.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },

    "repositories": [
        {
            "type": "path",
            "url": "./spark"
        }
    ]
}

Why isn't this lower version updated?

答案1

得分: 1

我需要翻译的部分如下:

  1. "Two things I had to solve, first add the repository mentioned in https://spark-satis.laravel.com/ into the composer.json, which wasn't there before."

    翻译:首先,我需要解决两个问题,第一个是将 https://spark-satis.laravel.com/ 中提到的存储库添加到 composer.json 中,这之前没有。

  2. "Next problem was the fact php8.1 was installed by default. Uninstalled, and installed php7.4"

    翻译:接下来的问题是默认安装了 PHP 8.1。卸载了它,并安装了 PHP 7.4。

  3. "Thanks matiaslauriti for point me into the right direction."

    翻译:感谢 matiaslauriti 指引我朝正确的方向前进。

英文:

Two things I had to solve, first add the repository mentioned in https://spark-satis.laravel.com/ into the composer.json, which wasn't there before.

Next problem was the fact php8.1 was installed by default. Uninstalled, and installed php7.4

Thanks matiaslauriti for point me into the right direction.

huangapple
  • 本文由 发表于 2023年3月12日 17:28:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75712183.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定