davy_yg's avatar
Level 27

Fatal error: Uncaught BadMethodCallException: Method Illuminate\Foundation\Application::configure does not exist. in D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:86

Hello,

I want to downgrade web app from Laravel 11 to Laravel 10. Then I get this error message:

D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0>composer update Composer could not detect the root package (laravel/laravel) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Installing dependencies from lock file (including require-dev) Nothing to install, update or remove Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

Fatal error: Uncaught BadMethodCallException: Method Illuminate\Foundation\Application::configure does not exist. in D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:86 Stack trace: #0 D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\bootstrap\app.php(7): Illuminate\Foundation\Application::__callStatic('configure', Array, basePath: 'D:\xampp81\htdo...') #1 D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\artisan(12): require_once('D:\xampp81\htdo...') #2 {main} thrown in D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php on line 86 PHP Fatal error: Uncaught BadMethodCallException: Method Illuminate\Foundation\Application::configure does not exist. in D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:86 Stack trace: #0 D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\bootstrap\app.php(7): Illuminate\Foundation\Application::__callStatic('configure', Array, basePath: 'D:\xampp81\htdo...') #1 D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\artisan(12): require_once('D:\xampp81\htdo...') #2 {main} thrown in D:\xampp81\htdocs\Ruang_Coding_Kasir_81\Kasir-1.2.0\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php on line 86 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

My composer.json:

"require": {

    "php": "^8.1",

    "laravel/framework": "^10"
    
},
"require-dev": {
    
},

Any idea why the error appears?

0 likes
3 replies
LaryAI's avatar
Level 58

The error you're encountering, BadMethodCallException: Method Illuminate\Foundation\Application::configure does not exist, suggests that your application is trying to call a method that doesn't exist in the version of Laravel you're using. This is likely due to some code or configuration that was valid in Laravel 11 but not in Laravel 10.

Here are the steps you can take to resolve this issue:

  1. Check the bootstrap/app.php File:

    • Open the bootstrap/app.php file and look for any calls to configure or other methods that might not exist in Laravel 10. Remove or replace these calls with the appropriate configuration for Laravel 10.
  2. Review Custom Service Providers:

    • If you have custom service providers, check them for any methods or configurations that might be specific to Laravel 11. Update them to be compatible with Laravel 10.
  3. Check for Third-Party Packages:

    • Some third-party packages might have dependencies or configurations that are specific to Laravel 11. Ensure that all your packages are compatible with Laravel 10. You might need to downgrade some packages or find alternatives.
  4. Clear Cache:

    • Sometimes, cached configurations can cause issues. Run the following commands to clear the cache:
      php artisan config:clear
      php artisan cache:clear
      php artisan view:clear
      php artisan route:clear
      
  5. Update Composer Autoload:

    • Regenerate the Composer autoload files to ensure all classes are correctly loaded:
      composer dump-autoload
      
  6. Check for Laravel 10 Documentation:

    • Review the Laravel 10 upgrade guide and documentation to ensure that your application is configured correctly for this version.
  7. Reinstall Dependencies:

    • If the issue persists, try removing the vendor directory and the composer.lock file, then run:
      composer install
      

By following these steps, you should be able to identify and resolve the issue causing the BadMethodCallException. If the problem persists, consider checking the Laravel forums or GitHub issues for similar cases.

Tray2's avatar

The first question is why the heck do you want to do that for?

The easiest would be to start a new Laravel 10 project, and then move your files over.

Snapey's avatar

At the very least, delete the vendor directory (totally) and then run composer install. However, your chances of success are small due to the changes in the app folder.

Please or to participate in this conversation.