skip to Main Content

I need some help…

I have uploaded to my plesk server a laravel project provided by a company.

However, it gives me the following error when displaying the web:
Whoops, something seems to have gone wrong.

When checking the Laravel.log I get the following message:

production.ERROR: SymfonyComponentDebugExceptionFatalThrowableError: Class 'LaravelSanctumSanctum' not found in /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/config/sanctum.php:21
Stack trace:
#0 /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(71): require()
#1 /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): IlluminateFoundationBootstrapLoadConfiguration->loadConfigurationFiles(Object(IlluminateFoundationApplication), Object(IlluminateConfigRepository))
#2 /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(208): IlluminateFoundationBootstrapLoadConfiguration->bootstrap(Object(IlluminateFoundationApplication))
#3 /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): IlluminateFoundationApplication->bootstrapWith(Array)
#4 /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(146): IlluminateFoundationHttpKernel->bootstrap()
#5 /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): IlluminateFoundationHttpKernel->sendRequestThroughRouter(Object(IlluminateHttpRequest))
#6 /var/www/vhosts/sweet-tharp.51-254-103-53.plesk.page/httpdocs/public/index.php(53): IlluminateFoundationHttpKernel->handle(Object(IlluminateHttpRequest))
#7 {main}  

After investigating I have seen that you are not supposed to have laravel/sanctum installed.

However, when installing it I get the following error:

# composer require laravel/sanctum
Execution /usr/bin/php has failed with exit code 2, stdout: , stderr: Using version ^2.15 for laravel/sanctum
./composer.json has been updated
Running composer update laravel/sanctum
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/sanctum ^2.15 -> satisfiable by laravel/sanctum[v2.15.0, v2.15.1].
    - laravel/sanctum[v2.15.0, ..., v2.15.1] require illuminate/console ^6.9|^7.0|^8.0|^9.0 -> found illuminate/console[v6.10.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.15] 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 laravel/sanctum:*" to figure out if any version is installable, or "composer require laravel/sanctum:^2.1" if you know which you need.

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

I have checked and it is supposed to update the laravel/framework and let me install the sanctum, however I get the following error when doing so:

# composer update laravel/framework
Execution /usr/bin/php has failed with exit code 1, stdout: Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
    
In sanctum.php line 21:
                                             
  Class 'LaravelSanctumSanctum' not found  
                                             

, stderr: Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package chumper/zipper is abandoned, you should avoid using it. No replacement was suggested.
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Package laravelcollective/html is abandoned, you should avoid using it. Use spatie/laravel-html instead.
Package maddhatter/laravel-fullcalendar is abandoned, you should avoid using it. No replacement was suggested.
Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
Class IlluminateSupportTraitsEnumeratesValues located in ./vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportArr located in ./vendor/laravel/framework/src/Illuminate/Collections/Arr.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportEnumerable located in ./vendor/laravel/framework/src/Illuminate/Collections/Enumerable.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportHigherOrderCollectionProxy located in ./vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportMultipleItemsFoundException located in ./vendor/laravel/framework/src/Illuminate/Collections/MultipleItemsFoundException.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportLazyCollection located in ./vendor/laravel/framework/src/Illuminate/Collections/LazyCollection.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportItemNotFoundException located in ./vendor/laravel/framework/src/Illuminate/Collections/ItemNotFoundException.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportCollection located in ./vendor/laravel/framework/src/Illuminate/Collections/Collection.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportTraitsMacroable located in ./vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportTraitsConditionable located in ./vendor/laravel/framework/src/Illuminate/Conditionable/Traits/Conditionable.php does not comply with psr-4 autoloading standard. Skipping.
Class IlluminateSupportHigherOrderWhenProxy located in ./vendor/laravel/framework/src/Illuminate/Conditionable/HigherOrderWhenProxy.php does not comply with psr-4 autoloading standard. Skipping.
Class AppMailFeder located in ./app/Http/Mail/Feder.php does not comply with psr-4 autoloading standard. Skipping.
Class AppMailContacto located in ./app/Http/Mail/Contact.php does not comply with psr-4 autoloading standard. Skipping.
Class AppMailFeder located in ./app/Http/Mail/Feder-antifraude.php does not comply with psr-4 autoloading standard. Skipping.
38 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> IlluminateFoundationComposerScripts::postUpdate
> php artisan optimize
Script php artisan optimize handling the post-update-cmd event returned with error code 1

However, it doesn’t, because it doesn’t have laravel/sanctum installed.

Can anyone help me to solve the error?

The proofs and evidences are in the explanation.

2

Answers


  1. Chosen as BEST ANSWER

    I tried to remove laravel/sanctum but it doesn't work either, it says this:

    # composer remove laravel/sanctum
    Execution /usr/bin/php has failed with exit code 1, stdout: Carbon 1 is deprecated, see how to migrate to Carbon 2.
    https://carbon.nesbot.com/docs/#api-carbon-2
        You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
        
    In sanctum.php line 21:
                                                 
      Class 'LaravelSanctumSanctum' not found  
                                                 
    
    , stderr: laravel/sanctum is not required in your composer.json and has not been removed
    ./composer.json has been updated
    Running composer update laravel/sanctum
    Loading composer repositories with package information
    Package "laravel/sanctum" listed for update is not locked.
    Updating dependencies
    Nothing to modify in lock file
    Installing dependencies from lock file (including require-dev)
    Nothing to install, update or remove
    Package chumper/zipper is abandoned, you should avoid using it. No replacement was suggested.
    Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
    Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
    Package laravelcollective/html is abandoned, you should avoid using it. Use spatie/laravel-html instead.
    Package maddhatter/laravel-fullcalendar is abandoned, you should avoid using it. No replacement was suggested.
    Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
    Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
    Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
    Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
    Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
    Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
    Generating optimized autoload files
    Class IlluminateSupportTraitsEnumeratesValues located in ./vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportArr located in ./vendor/laravel/framework/src/Illuminate/Collections/Arr.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportEnumerable located in ./vendor/laravel/framework/src/Illuminate/Collections/Enumerable.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportHigherOrderCollectionProxy located in ./vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportMultipleItemsFoundException located in ./vendor/laravel/framework/src/Illuminate/Collections/MultipleItemsFoundException.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportLazyCollection located in ./vendor/laravel/framework/src/Illuminate/Collections/LazyCollection.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportItemNotFoundException located in ./vendor/laravel/framework/src/Illuminate/Collections/ItemNotFoundException.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportCollection located in ./vendor/laravel/framework/src/Illuminate/Collections/Collection.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportTraitsMacroable located in ./vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportTraitsConditionable located in ./vendor/laravel/framework/src/Illuminate/Conditionable/Traits/Conditionable.php does not comply with psr-4 autoloading standard. Skipping.
    Class IlluminateSupportHigherOrderWhenProxy located in ./vendor/laravel/framework/src/Illuminate/Conditionable/HigherOrderWhenProxy.php does not comply with psr-4 autoloading standard. Skipping.
    Class AppMailFeder located in ./app/Http/Mail/Feder.php does not comply with psr-4 autoloading standard. Skipping.
    Class AppMailContacto located in ./app/Http/Mail/Contact.php does not comply with psr-4 autoloading standard. Skipping.
    Class AppMailFeder located in ./app/Http/Mail/Feder-antifraude.php does not comply with psr-4 autoloading standard. Skipping.
    38 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    > IlluminateFoundationComposerScripts::postUpdate
    > php artisan optimize
    Script php artisan optimize handling the post-update-cmd event returned with error code 1
    

    Anyway, for what it's worth I've also tried require laravel/sanctum:* but it gives me error too.

    # composer require laravel/sanctum:*
    Execution /usr/bin/php has failed with exit code 2, stdout: , stderr: Info from https://repo.packagist.org: #StandWithUkraine
    ./composer.json has been updated
    Running composer update laravel/sanctum
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - laravel/sanctum[v0.1.0, ..., v0.2.1, v1.0.0] require illuminate/contracts ^6.0|^7.0 -> found illuminate/contracts[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6] but these were not loaded, likely because it conflicts with another require.
        - laravel/sanctum[v1.0.1, v2.0.0, ..., v2.4.2] require illuminate/contracts ^6.9|^7.0 -> found illuminate/contracts[v6.10.0, ..., v6.20.44, v7.0.0, ..., v7.30.6] but these were not loaded, likely because it conflicts with another require.
        - laravel/sanctum[v2.5.0, ..., v2.13.0] require illuminate/contracts ^6.9|^7.0|^8.0 -> found illuminate/contracts[v6.10.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
        - laravel/sanctum[v2.14.0, ..., v2.14.2] require illuminate/contracts ^6.9|^7.0|^8.0|^9.0 -> found illuminate/contracts[v6.10.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.15] but these were not loaded, likely because it conflicts with another require.
        - laravel/sanctum[v2.15.0, ..., v2.15.1] require illuminate/console ^6.9|^7.0|^8.0|^9.0 -> found illuminate/console[v6.10.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.15] but these were not loaded, likely because it conflicts with another require.
        - laravel/sanctum[v3.0.0, ..., v3.2.5] require php ^8.0.2 -> your php version (7.3.31) does not satisfy that requirement.
        - Root composer.json requires laravel/sanctum * -> satisfiable by laravel/sanctum[v0.1.0, v0.2.0, v0.2.1, v1.0.0, v1.0.1, v2.0.0, ..., v2.15.1, v3.0.0, ..., v3.2.5].
    
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
    

  2. You have a conflict in your composer file. The version of sanctum you’re trying to install isn’t compatible with the console library. You should remove sanctum from the composer file and then run the following command to see which version is compatible with the other libraries you have installed:

    composer require laravel/sanctum:*
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search