-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
composer install --no-dev --optimize-autoloader return class not found. #36604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you share your |
Yes. {
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/annotations": "^1.10",
"google/apiclient": "2.0",
"sensio/framework-extra-bundle": "^5.5",
"symfony/console": "5.0.*",
"symfony/dotenv": "5.0.*",
"symfony/flex": "^1.3.1",
"symfony/form": "5.0.*",
"symfony/framework-bundle": "5.0.*",
"symfony/security-bundle": "5.0.*",
"symfony/serializer-pack": "^1.0",
"symfony/string": "5.0.*",
"symfony/translation": "5.0.*",
"symfony/validator": "5.0.*",
"symfony/yaml": "5.0.*"
},
"require-dev": {
"symfony/maker-bundle": "^1.15"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.0.*"
}
}
} |
Well, your kernel still tries to load the DoctrineBundle (for example in |
I didn't do anything. It's just a Symfony project from I just follow this doc to install Doctrine How can I fix it? |
Looks like somehow the ORM pack was removed. Does running |
I don't know why it was removed from the composer require symfony/orm-pack Then composer install --no-dev --optimize-autoloader
Thanks for your support :) |
Without actually knowing what output your received before or what might have happened additionally that's indeed hard to say. :) But I am glad that you managed to resolve your issue. |
Hello, In short if you have issue of missing package / (class not found) after running the above command -> the solution is just add that package to section "require" (this is production sections) or run "composer require symfony/yourmissingpackageorclass" that will fix it. A late one, but thank you for sharing. I found out that when going into production, there are some packages you have to move from dev to prod for example: in your composer.json "require": { package-from-dev:version, package2:version, package3:version} this post helps me. |
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 rancomposer require symfony/dotenv
. I setAPP_ENV=prod
in the.env
. Note I don't have.env.local
but.env.local.php
. I ranexport APP_ENV=prod
thenexport SYMFONY_ENV=prod
. And finallycomposer 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
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
The text was updated successfully, but these errors were encountered: