kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
992 stars 163 forks source link

issue while installing package #134

Closed Faisal-Naseer closed 1 year ago

Faisal-Naseer commented 2 years ago

I am trying to install this package using composer require kreait/laravel-firebase on laravel 9 I am getting this error

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.2",
        "laravel/passport": "^10.3",
        "laravel/sanctum": "^2.14.1",
        "laravel/tinker": "^2.7",
        "orangehill/iseed": "^3.0"
    },
    "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
}

Issues

  Problem 1
    - kreait/firebase-php[6.0.0, ..., 6.x-dev] require lcobucci/jwt ^4.1 -> found lcobucci/jwt[4.1.0, ..., 4.2.x-dev] but the package is fixed to 4.0.4 (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.
    - kreait/laravel-firebase 4.1.0 requires kreait/firebase-php ^6.0 -> satisfiable by kreait/firebase-php[6.0.0, ..., 6.x-dev].
    - Root composer.json requires kreait/laravel-firebase ^4.1 -> satisfiable by kreait/laravel-firebase[4.1.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require kreait/laravel-firebase:*" to figure out if any version is installable, or "composer require kreait/laravel-firebase:^2.1" if you know which you need.
jeromegamez commented 2 years ago

As the Problem message suggests, please require the package with the --with-all-dependencies/-W option, this way all the dependencies the SDK needs should be updated.

If this doesn't work (although I'm confident it will), check which other library blocks lcobucci/jwt with composer why lcobucci/jwt, this should give you the needed information on which library to upgrade. 🤞

adambctld commented 2 years ago

Laravel passport is what was throwing that same error for me. So i just ran composer remove laravel/passport and then I was able to install the package.

Faisal-Naseer commented 2 years ago

Laravel passport is what was throwing that same error for me. So i just ran composer remove laravel/passport and then I was able to install the package.

yeah but what if we wanted to use both passport with this package

jeromegamez commented 2 years ago

Have you tried what I suggested? If yes and it didn't work, what's the output?

Composer is really helpful in determining which libraries are conflicting. It's definitely not lcobucci/jwt, since passport requires ^4.0 and the Firebase SDK requires ^4.1.

vamsikt commented 2 years ago

@jeromegamez I am also seeing errors when installing.

Laravel version - 8.70.2

composer dumpautoload

Generating optimized autoload files

composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In ProviderRepository.php line 208:

  Class 'Kreait\Laravel\Firebase\ServiceProvider' not found  

composer list :

    "require": {
        "php": "^7.3|^8.0",
        "fideloper/proxy": "^4.4",
        "freshbitsweb/laratables": "^2.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "kreait/laravel-firebase": "^4.13",
        "laravel/framework": "^8.54",
        "laravel/passport": "^10.1",
        "laravel/sanctum": "^2.11",
        "laravel/socialite": "^5.2",
        "laravel/tinker": "^2.5",
        "laravel/ui": "^3.3",
        "laravelcollective/html": "^6.2",
        "maatwebsite/excel": "^3.1",
        "sentry/sentry-laravel": "^2.8"
    }

vendor publish option also not working.

jeromegamez commented 2 years ago

Unfortunately, I'm not able to reproduce this problem. This is what I did to do so:

laravel new l9firebase
cd l9firebase
composer require kreait/laravel-firebase
php artisan tinker

Psy Shell v0.11.4 (PHP 8.1.6 — cli) by Justin Hileman
>>> app('firebase.auth')
=> Kreait\Firebase\Auth {#3613}

Could you please try this as well and tell me if that works?

rinkuanuragkumar commented 1 year ago

I'm unable to install on Laravel 8.40 Kindly resolve my issue as soon as possible. Below are the error logs...

composer require kreait/laravel-firebase

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.1 for kreait/laravel-firebase
./composer.json has been updated
Running composer update kreait/laravel-firebase
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - kreait/firebase-php 6.x-dev requires symfony/polyfill-php80 ^1.23 -> found symfony/polyfill-php80[dev-main, v1.23.0, ..., 1.26.x-dev (alias of dev-main)] but the package is fixed to v1.22.1 (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.
    - kreait/firebase-php[6.0.0, ..., 6.4.0] require guzzlehttp/guzzle ^7.4 -> found guzzlehttp/guzzle[dev-master, 7.4.0, ..., 7.4.x-dev (alias of dev-master)] but the package is fixed to 7.3.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.
    - kreait/firebase-php 6.4.1 requires guzzlehttp/guzzle ^7.4.4 -> found guzzlehttp/guzzle[dev-master, 7.4.4, 7.4.5, 7.4.x-dev (alias of dev-master)] but the package is fixed to 7.3.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.
    - kreait/firebase-php[6.5.0, ..., 6.5.1] require guzzlehttp/guzzle ^7.4.5 -> found guzzlehttp/guzzle[dev-master, 7.4.5, 7.4.x-dev (alias of dev-master)] but the package is fixed to 7.3.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.
    - kreait/laravel-firebase 4.1.0 requires kreait/firebase-php ^6.0 -> satisfiable by kreait/firebase-php[6.0.0, ..., 6.x-dev].
    - Root composer.json requires kreait/laravel-firebase ^4.1 -> satisfiable by kreait/laravel-firebase[4.1.0].

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.

When running with --with-all-dependencies (-W) then results are...

composer require kreait/laravel-firebase --with-all-dependencies

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.1 for kreait/laravel-firebase
./composer.json has been updated
Running composer update kreait/laravel-firebase --with-all-dependencies
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires laravel/framework ^8.12, found laravel/framework[v8.12.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - laravel/tinker is locked to version v2.6.1 and an update of this package was not requested.
    - laravel/tinker v2.6.1 requires illuminate/console ^6.0|^7.0|^8.0 -> found illuminate/console[v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 3
    - laravel/ui is locked to version v3.2.1 and an update of this package was not requested.
    - laravel/ui v3.2.1 requires illuminate/console ^8.0 -> found illuminate/console[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 4
    - spatie/laravel-permission is locked to version 4.3.0 and an update of this package was not requested.
    - spatie/laravel-permission 4.3.0 requires illuminate/auth ^6.0|^7.0|^8.0 -> found illuminate/auth[v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 5
    - tymon/jwt-auth is locked to version 1.0.2 and an update of this package was not requested.
    - tymon/jwt-auth 1.0.2 requires illuminate/auth ^5.2|^6|^7|^8 -> found illuminate/auth[v5.2.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 6
    - uxweb/sweet-alert is locked to version 2.0.5 and an update of this package was not requested.
    - uxweb/sweet-alert 2.0.5 requires illuminate/session ~5.0|^6.0|^7.0|^8.0 -> found illuminate/session[v5.0.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 7
    - yajra/laravel-datatables-oracle is locked to version v9.19.0 and an update of this package was not requested.
    - yajra/laravel-datatables-oracle v9.19.0 requires illuminate/database 5.8.*|^6|^7|^8|^9 -> found illuminate/database[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev, v9.0.0-beta.1, ..., 9.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 8
    - laravel/sail is locked to version v1.5.0 and an update of this package was not requested.
    - laravel/sail v1.5.0 requires illuminate/console ^8.0|^9.0 -> found illuminate/console[v8.0.0, ..., 8.x-dev, v9.0.0-beta.1, ..., 9.x-dev] but these were not loaded, likely because it conflicts with another require.
  Problem 9
    - facade/flare-client-php 1.8.0 requires illuminate/pipeline ^5.5|^6.0|^7.0|^8.0 -> found illuminate/pipeline[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
    - facade/ignition 2.8.4 requires facade/flare-client-php ^1.6 -> satisfiable by facade/flare-client-php[1.8.0].
    - facade/ignition is locked to version 2.8.4 and an update of this package was not requested.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
jeromegamez commented 1 year ago

@rinkuanuragkumar "As soon as possible" is reserved for paying clients and sponsors 😅. Now seriously:

You have multiple dependency problems which are not related to the Firebase package. If you look closely at the output, you will see that many of your dependencies are fixed/locked.

Before requiring the kreait/laravel-firebase, do a composer update --with-all-dependencies - then try the composer require kreait/laravel-firebase --with-all-dependencies again.

beshoo commented 1 year ago

@rinkuanuragkumar "As soon as possible" is reserved for paying clients and sponsors 😅. Now seriously:

You have multiple dependency problems which are not related to the Firebase package. If you look closely at the output, you will see that many of your dependencies are fixed/locked.

Before requiring the kreait/laravel-firebase, do a composer update --with-all-dependencies - then try the composer require kreait/laravel-firebase --with-all-dependencies again.


 composer require kreait/laravel-firebase --with-all-dependencies
Using version ^5.2 for kreait/laravel-firebase
./composer.json has been updated
Running composer update kreait/laravel-firebase --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
    - kreait/firebase-php[7.0.0, ..., 7.0.3] require lcobucci/jwt ^4.2.1 -> found lcobucci/jwt[4.2.1, 4.3.0] but these were not loaded, likely because it conflicts with another require.
    - kreait/firebase-php[7.1.0, ..., 7.2.1] require lcobucci/jwt ^4.3.0|^5.0 -> found lcobucci/jwt[4.3.0, 5.0.0] but these were not loaded, likely because it conflicts with another require.
    - kreait/laravel-firebase 5.2.0 requires kreait/firebase-php ^7.0 -> satisfiable by kreait/firebase-php[7.0.0, ..., 7.2.1].
    - Root composer.json requires kreait/laravel-firebase ^5.2 -> satisfiable by kreait/laravel-firebase[5.2.0].

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

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

And


PS D:\xampp\htdocs\move_subtitle> composer require kreait/laravel-firebase --ignore-platform-reqs 
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^5.2 for kreait/laravel-firebase
./composer.json has been updated
Running composer update kreait/laravel-firebase
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - kreait/firebase-php[7.0.0, ..., 7.0.3] require lcobucci/jwt ^4.2.1 -> found lcobucci/jwt[4.2.1, 4.3.0] but the package is fixed to 3.2.5 (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.
    - kreait/firebase-php[7.1.0, ..., 7.2.1] require lcobucci/jwt ^4.3.0|^5.0 -> found lcobucci/jwt[4.3.0, 5.0.0] but the package is fixed to 3.2.5 (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.
    - kreait/laravel-firebase 5.2.0 requires kreait/firebase-php ^7.0 -> satisfiable by kreait/firebase-php[7.0.0, ..., 7.2.1].
    - Root composer.json requires kreait/laravel-firebase ^5.2 -> satisfiable by kreait/laravel-firebase[5.2.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require kreait/laravel-firebase:*" to figure out if any version is installable, or "composer require kreait/laravel-firebase:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
PS D:\xampp\htdocs\move_subtitle>