Skip to content

composer install --no-dev --optimize-autoloader return class not found. #36604

@Guervyl

Description

@Guervyl

Symfony version(s) affected: 5.0

Description
I am following this guide: https://symfony.com/doc/current/deployment.html#common-post-deployment-tasks.

I'm on a linux system. Centos 7.

I uploaded my source code on the server. I installed the dependencies on the server. I ran composer dump-env prod. I ran composer require symfony/dotenv. I set APP_ENV=prod in the .env. Note I don't have .env.local but .env.local.php. I ran export APP_ENV=prod then export SYMFONY_ENV=prod. And finally composer install --no-dev --optimize-autoloader.

The output of composer is:

Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 23 removals

  • Removing zendframework/zend-eventmanager (3.2.1)
  • Removing zendframework/zend-code (3.4.1)
  • Removing symfony/stopwatch (v5.0.7)
  • Removing symfony/orm-pack (v1.0.8)
  • Removing symfony/maker-bundle (v1.15.0)
  • Removing symfony/doctrine-bridge (v5.0.7)
  • Removing ocramius/proxy-manager (2.2.3)
  • Removing ocramius/package-versions (1.5.1)
  • Removing nikic/php-parser (v4.3.0)
  • Removing jdorn/sql-formatter (v1.2.17)
  • Removing doctrine/reflection (1.2.1)
  • Removing doctrine/persistence (1.3.7)
  • Removing doctrine/orm (v2.7.2)
  • Removing doctrine/migrations (2.2.1)
  • Removing doctrine/instantiator (1.3.0)
  • Removing doctrine/inflector (1.3.1)
  • Removing doctrine/event-manager (1.1.0)
  • Removing doctrine/doctrine-migrations-bundle (2.1.2)
  • Removing doctrine/doctrine-bundle (2.0.7)
  • Removing doctrine/dbal (v2.10.1)
  • Removing doctrine/common (2.12.0)
  • Removing doctrine/collections (1.6.4)
  • Removing doctrine/cache (1.10.0)
    Generating optimized autoload files
    ocramius/package-versions: Package not found (probably scheduled for removal); generation of version class skipped.
    Executing script cache:clear [KO]
    [KO]
    Script cache:clear returned with error code 255
    !!
    !! Fatal error: Uncaught Error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found in /home/trantkwr/public_html/src/Kernel.php:23
    !! Stack trace:
    !! #0 /home/trantkwr/public_html/vendor/symfony/http-kernel/Kernel.php(369): App\Kernel->registerBundles()
    !! Untitled #1 /home/trantkwr/public_html/vendor/symfony/http-kernel/Kernel.php(123): Symfony\Component\HttpKernel\Kernel->initializeBundles()
    !! Renaming "Entities" to "Entity" #2 /home/trantkwr/public_html/vendor/symfony/framework-bundle/Console/Application.php(169): Symfony\Component\HttpKernel\Kernel->boot()
    !! Untitled #3 /home/trantkwr/public_html/vendor/symfony/framework-bundle/Console/Application.php(75): Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands()
    !! Same change for mapping files #4 /home/trantkwr/public_html/vendor/symfony/console/Application.php(140): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    !! Using ORM and MongoDB both in the same bundle. #5 /home/trantkwr/public_html/bin/console(42): Symfony\Component\Console\Application->run(Object(Symfony\Compo in /home/trantkwr/public_html/src/Kernel.php on line 23
    !!
    Script @auto-scripts was called via post-install-cmd

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions