Symfony deployment: error code 255 with composer install --no-dev - symfony

Here are the steps, I am following:
Cloning my repository from github
git clone https://github.com/EresDev/EresNoteSymfony.git .
Updating .env file with APP_ENV=prod
Then performing install
composer install --no-dev
I get following error:
.
.
.
- Installing symfony/translation (v4.2.4): Loading from cache
- Installing symfony/validator (v4.2.4): Loading from cache
- Installing symfony/yaml (v4.2.4): Loading from cache
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
Script #auto-scripts was called via post-install-cmd
However, it works fine if I just use composer install without --no-dev
What can I do to make it work with --no-dev
Please refer to repository to access code if required.

apparently you have somehow managed to turn error display off (or it's some default). I get a very distinct error message when I run composer install --no-dev (run with commit e722218...)
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TwigBundle" from namespace "Symfony\Bundle\TwigBundle".
!! Did you forget a "use" statement for another namespace? in [path]/EresNoteSymfony/src/Kernel.php:23
!! Stack trace:
!! #0 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!! #1 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 [path]/EresNoteSymfony/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 [path]/EresNoteSymfony/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 [path]/EresNoteSymfony/bin/console(38): Symfony\Component\Console\Application->run(Object(Symfony\Componen in [path]/EresNoteSymfony/src/Kernel.php on line 23
!!
you should somehow turn error display on ;o)
update:
your config/bundles.php:6 says:
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
which essentially says, the twigbundle is expected in prod as well as in dev. thus the error? (but anyway, the point still stands, that you should display errors when running on cli)
after you change that line in your bundles.php, you have to move your twig.yaml config into the dev/test folders, I suppose.

Related

The deprecation template must contain the "%service_id%" placeholder

i'm new to symfony 4, i tried to install admin panel by composer require admin command, but it sounds error :
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In Definition.php line 770:
!!
!! The deprecation template must contain the "%service_id%" placeholder.
!!
!!
!!
Script #auto-scripts was called via post-update-cmd
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
a new commit that seems to fix this issue was merged today in the repo EasyCorp/EasyAdminBundle.
Until they release next version, you could do
symfony composer req admin:3.0.x-dev

I am getting error when use start command in symfony

I am very new to Symfony. I have installed Symfony in my system with symfony demo command it's working fine. I installed in that folder already developed project code. when use php bin/console server:start 0.0.0.0:8000 this command I am getting error:
PHP Fatal error: Uncaught RuntimeException: The autoloader expected class "AppKernel" to be defined in file "/home/Desktop/commercetools-sunrise-php-master/vendor/composer/../../app/AppKernel.php". The file was found but the class was not in it, the class name or namespace probably has a typo. in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:223
Stack trace:#0 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('AppKernel')#1 /home/Desktop/commercetools-sunrise-php-master/bin/console(26): spl_autoload_call('AppKernel')#2 {main}
thrown in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php on line 223
Any one can help me. Thanks in advance.
There may be a corrupted generated PHP file. Try this :
composer run-script post-install-cmd

Cannot Composer Install with Symfony - PhpStorm

I had a problem with my Ubuntu so I needed to install back everything.
Nearly all is done but when I start a new project with Symfony on PhpStorm, and when I do a composer install or composer update in the terminal I have an error that I don't know how to treat.
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DOMDocument" from the global namespace.
Did you forget a "use" statement? in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52
Stack trace:
#0 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(284): Symfony\Component\Config\Util\XmlUtils::loadFile('/var/www/html/E...', Array)
#1 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/var/ww
w/html/E...')
#2 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(57): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load('web.xm
l')
#3 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/
Config/Util/XmlUtils.php on line 52
I tried installing composer following this link
but I don't recall using such practice.
So I cannot move forward with my project because I can't get past composer... if anyone knows why and could give me a step-by-step approach that would be truly appreciated.
Thank you
PHP's DOMDocument library is not installed. You need to install it. Try -
sudo apt-get install php-dom

Having issue on installing symfony doctrine-migrations-bundle

While I run command php composer.phar update it shows the following error. Can anyone help me out for fix it?
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Call to protected DoctrineORMEntit
yManager_000000001f94ab4b000000005d7f3b02e5139c916d21af4abfe5ffe5dd20d49e::__construct() from context 'appDevDebugProjectCon
tainer' in /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:747
Stack trace:
#0 /var/www/html/app/bootstrap.php.cache(2125): appDevDebugProjectContainer->getDoctrine_Orm_DefaultEntityManagerService()
#1 /var/www/html/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ManagerRegistry.php(35): Symfony\Component\DependencyInj
ection\Container->get('doctrine.orm.de...')
#2 /var/www/html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php(231): Symfony\Bridge\Doc
trine\ManagerRegistry->getService('doctrine.orm.de...')
#3 /var/www/html/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php(54): Doctrine\Common\Pe
rsistence\AbstractManagerRegistry->getManagers()
#4 /var/www/html/vendor/symfony/symfony/src/Symfony/Compo in /var/www/html/app/cache/dev/appDevDebugProjectContainer.php on
line 747
First remove the bundle from your composer.json.
Then try :
// replace app by var depending on your symfony version (2 or 3)
rm -Rf app/cache
// clean all your dependencies
rm -Rf vendor
// reinstall them from your composer.lock
composer install
// install this particular bundle
composer require doctrine/doctrine-migrations-bundle "^1.0"

stange error with Behat and Mink on Sf2

I'm using Behat,mink in my Symfony2 project,so I follow those tutorials to make installation :
http://extensions.behat.org/symfony2/ , http://extensions.behat.org/symfony2/migrating_from_2.3_to_2.4.html
but when I run this command php behat.phar --init "#YouBundleName",I get this very strange error :
PHP Warning: require(Behat\MinkExtension\Extension): failed to open stream: No such file or directory in phar:///var/www/project/behat.phar/src/Behat/Behat /Extension/ExtensionManager.php on line 112
PHP Fatal error: require(): Failed opening required 'Behat\MinkExtension\Extension' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///var/www/project/behat.phar/src/Behat/Behat/Extension/ExtensionManager.php on line 112
I'm sure I installed the last version of behat and mink mentionned in the second link above and then I made php composer.phar unpdate and cache clear too,but still the same error?
I had the same problem. Forgot you need to install behat/mink-extension as well as behat/mink. For example you might need to run:
php composer.phar require behat/mink-extension:*
Worked for me.
By the way, looks like you got confused by the two installation methods, phar vs composer. I'd go with the composer route because it's easier to update and manage versions. This would mean running php bin/behat ... instead of php behat.phar ....

Resources