Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version problem in composer for clean Laravel 9. #561

Closed
divoto opened this issue Feb 10, 2022 · 10 comments
Closed

version problem in composer for clean Laravel 9. #561

divoto opened this issue Feb 10, 2022 · 10 comments

Comments

@divoto
Copy link

divoto commented Feb 10, 2022

Q A
Bug report? no
Feature request? yes
Library version x.y.z

On clean Laravel 9 i get error when using composer require:

`composer require nunomaduro/phpinsights --dev
Using version ^2.1 for nunomaduro/phpinsights
./composer.json has been updated
Running composer update nunomaduro/phpinsights
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 nunomaduro/phpinsights ^2.1 -> satisfiable by nunomaduro/phpinsights[v2.1.0].
- nunomaduro/phpinsights v2.1.0 requires psr/simple-cache ^1.0 -> found psr/simple-cache[1.0.0, 1.0.1] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
`
Again problem with psr/simple-cache.

Thank you.

@yoeriboven
Copy link

Yeah, I got the same on an upgraded installation instead of a clean one.

@50bhan
Copy link
Contributor

50bhan commented Feb 13, 2022

Yes, there is an issue with dependencies. But you can fix it with composer require nunomaduro/phpinsights --dev --with-all-dependencies until the fix.

@divoto
Copy link
Author

divoto commented Feb 15, 2022

Hi @50bhan . I have try it but without any success:

$ composer require nunomaduro/phpinsights --dev --with-all-dependencies
Using version ^2.1 for nunomaduro/phpinsights
./composer.json has been updated
Running composer update nunomaduro/phpinsights --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/translation v6.0.3 requires symfony/translation-contracts ^2.3|^3.0 -> found symfony/translation-contracts[dev-main, v2.3.0, ..., 2.5.x-dev, v3.0.0, 3.0.x-dev, 3.1.x-dev (alias of dev-main)] but it conflicts with another require.
    - laravel/framework v9.0.2 requires nesbot/carbon ^2.53.1 -> satisfiable by nesbot/carbon[2.56.0].
    - nesbot/carbon 2.56.0 requires symfony/translation ^3.4 || ^4.0 || ^5.0 || ^6.0 -> satisfiable by symfony/translation[v6.0.3].
    - laravel/framework is locked to version v9.0.2 and an update of this package was not requested.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

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

@50bhan
Copy link
Contributor

50bhan commented Feb 15, 2022

@divoto It's odd! Because I was able to install the package on a clean L9.

Screen Shot 2022-02-15 at 12 17 21

@divoto
Copy link
Author

divoto commented Feb 16, 2022

@divoto It's odd! Because I was able to install the package on a clean L9.

Screen Shot 2022-02-15 at 12 17 21

What version of PHP. Mine is 8.0

@divoto
Copy link
Author

divoto commented Feb 16, 2022

Hi @50bhan
I had time today to debug te error. It appears that was in conflict with psr/simple-cache that i had updated to 3.0 while phpinsights requires 1.0.*
Thanks for the support.

@tavsec
Copy link

tavsec commented Feb 22, 2022

Hi, I think that I have a connected issue. I managed to install phpinsights, but when I run php artisan insights, I get the following error:

❯ php artisan insights

 29/29 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ✨ Analysis Completed !

[2022-02-22 12:15:58] `/Users/path/to/my/project`


   TypeError 

  Cannot assign Composer\PartialComposer to property NunoMaduro\PhpInsights\Domain\ComposerLoader::$composer of type ?Composer\Composer

  at vendor/nunomaduro/phpinsights/src/Domain/ComposerLoader.php:30
     26▕             self::$currentCollector = $collector;
     27▕ 
     28▕             $io = new NullIO();
     29▕             $composerPath = ComposerFinder::getPath($collector);
  ➜  30▕             self::$composer = (new Factory())->createComposer($io, ComposerFinder::getPath($collector), false, null, false);
     31▕             self::$composer->setLocker(self::getLocker($composerPath, $io));
     32▕         }
     33▕ 
     34▕         return self::$composer;

      +22 vendor frames 
  23  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

This is my composer.json file:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "fruitcake/laravel-cors": "^2.0.5",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.0",
        "laravel/sanctum": "^2.14",
        "laravel/tinker": "^2.7",
        "psr/simple-cache": "1.0.*"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/envoy": "^2.8",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "nunomaduro/phpinsights": "^2.1",
        "php-parallel-lint/php-console-highlighter": "~0.3",
        "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,
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

I tried deleting vendor and composer.lock, as well as running composer update, but that did not fix the problem. Any ideas how could I fix the issue?

@50bhan
Copy link
Contributor

50bhan commented Feb 24, 2022

@tavsec Please follow this issue #565

@cmgmyr
Copy link
Collaborator

cmgmyr commented Mar 8, 2022

fixed in #566

@cmgmyr cmgmyr closed this as completed Mar 8, 2022
@Sergiobop
Copy link

The problem is not solved @cmgmyr

Problem 1
- Root composer.json requires nunomaduro/phpinsights ^2.2 -> satisfiable by nunomaduro/phpinsights[v2.2.0].
- nunomaduro/phpinsights v2.2.0 requires psr/simple-cache ^1.0 -> found psr/simple-cache[1.0.0, 1.0.1] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants