Search code examples
laravel-5composer-phplaravel-backpack

Solving dependecy conflict for upgrading laravel backpack


I'm attempting to upgrade laravel backpack to v3.4.0 guiding by this document.

currently this laravel version is 5.7.x.(yeah it is really outdated project).

in 9th step says run php artisan backpack:base:install, when in run this command this error will be occur :


The command "composer require laracasts/generators:dev-master --dev" failed.           
                                                                                         
  Exit Code: 2(Misuse of shell builtins)                                                 
                                                                                         
  Working directory: /home/user/php/laravel/                             
                                                                                         
  Output:                                                                                
  ================                                                                       
                                                                                         
                                                                                         
  Error Output:                                                                          
  ================                                                                       
  ./composer.json has been updated                                                       
  Running composer update laracasts/generators                                           
  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 laracasts/generators dev-master -> satisfiable by l  
  aracasts/generators[dev-master].                                                       
      - laracasts/generators dev-master requires illuminate/support ~6.0|~7.0|~8.0|~9.0  
  |^10.0 -> found illuminate/support[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.  
  0, ..., v8.83.27, v9.0.0, ..., v9.52.7, v10.0.0, ..., v10.9.0] but these were not loa  
  ded, likely because it conflicts with another require.                                 
                                                                                         
  Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removal  
  s for packages currently locked to specific versions.                                  
                                                                                         
  Installation failed, reverting ./composer.json and ./composer.lock to their original   
  content.

In summary laracasts/generators depends on illuminate/support v6.0.0 - v10.9.0 which is not loaded.

how should i solve this conflict?

as error says : i have tried run this command with -W option which is : composer require laracasts/generators:dev-master --dev -W and same error has occured :

- Root composer.json requires laracasts/generators dev-master -> satisfiable by laracasts/generators[dev-master].
    - laracasts/generators dev-master requires illuminate/support ~6.0|~7.0|~8.0|~9.0|^10.0 -> found illuminate/support[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.7, v10.0.0, ..., v10.9.0] but these were not loaded, likely because it conflicts with another require.
`


Solution

  • Your issue is;

    1. Backpack v3.4 requires Laravel v5.
    2. laracasts/generators:dev-master requires Laravel v6 or higher.

    In order to have Backpack v3.4 AND generators, you must install version ^1.2 (1.2.0 is the latest v1, you can check on packagist).

    The following command should fix your issue;

    composer require laracasts/generators:^1.2
    

    Since this backpack install command fails at that point, you'll need to run the remaining commands by yourself.

    So, please make sure after the previous command you run the other ones on the installation command:

    php artisan vendor:publish --provider="Backpack\Base\BaseServiceProvider" --tag=minimum
    
    php artisan vendor:publish --provider="Prologue\Alerts\AlertsServiceProvider"
    
    php artisan migrate
    
    php artisan backpack:base:publish-user-model
    
    php artisan backpack:base:publish-middleware
    

    Quick note; many times while updating many major version on a composer project, I'm forced to delete the vendor folder and composer.lock, in order to have everything installed without dependency issues.