Flex: [Bug] Error when installing "form" package

Created on 4 Apr 2017  路  9Comments  路  Source: symfony/flex

In a fresh Symfony app, I install form without problems:

$ composer require form

Using version ^3.3@dev for symfony/form
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
  - Installing symfony/inflector (dev-master 3b19c08): Loading from cache
  - Installing symfony/property-access (dev-master 65b1197): Loading from cache
  - Installing symfony/options-resolver (dev-master 5edcb71): Loading from cache
  - Installing symfony/intl (dev-master dc7b5a5): Loading from cache
  - Installing symfony/polyfill-intl-icu (dev-master 2d6e2b2): Loading from cache
  - Installing symfony/form (dev-master 38a1f33): Downloading (100%)
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Skipping "assets:install --symlink --relative web" (needs symfony/console to run).

However, if I install cli afterwards, I see this error (I made no change in the app between the installation of "form" and "cli"):

$ composer req cli

Using version ^3.3@dev for symfony/console
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing symfony/console (dev-master 1030e32): Loading from cache
    Detected auto-configuration settings for "symfony/console"
    Setting configuration and copying files
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative %WEB_DIR% [KO]
 [KO]
Script assets:install --symlink --relative %WEB_DIR% returned with error code 1
!!
!!
!!    [Symfony\Component\DependencyInjection\Exception\LogicException]
!!    Form support cannot be enabled as the Translation component is not installe
!!    d.
!!
!!
!!
!!

Installation failed, reverting ./composer.json to its original content.
bug

All 9 comments

I don't think the issue is the installation of symfony/console.

The difference is that once symfony/console gets installed, the console command is running instead of being skipped, and so requires being able to boot the kernel without error.
Try booting the kernel after your first command, and you will see that it is the one being broken already (except that you never tried your project at that point)

I tried to install a bundle that depends on Symfony Console, and got the same error. Here's how to reproduce the error:

# cd /tmp; rm -rf demo
composer create-project symfony/skeleton:3.3.x-dev demo
cd demo
composer require gnugat/micro-framework-bundle:^0.5

The output of the last command:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing symfony/console (dev-master 0f04702): Loading from cache
    Detected auto-configuration settings for "symfony/console"
    Setting configuration and copying files
  - Installing gnugat/micro-framework-bundle (v0.5.2): Loading from cache
    Detected auto-configuration settings for "gnugat/micro-framework-bundle"
    Enabling the package as a Symfony bundle
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative %WEB_DIR% [KO]
 [KO]
Script assets:install --symlink --relative %WEB_DIR% returned with error code 1
!!  
!!  
!!                                                                            
!!  
!!    [Symfony\Component\DependencyInjection\Exception\OutOfBoundsException]  
!!    Cannot replace arguments if none have been configured yet.              
!!  
!!                                                                            
!!  
!!  
!!  

Installation failed, reverting ./composer.json to its original content.

:thinking: actually, it looks like my error comes from the fact that %WEB_DIR% isn't set after creating the project.

Hmm, personally got this after composer update command:

wunder@code-2017-VirtualBox:~/PhpstormProjects/symfony-flex-backend$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 21 updates, 0 removals
  - Removing symfony/flex (dev-master d4681b5)
  - Installing symfony/flex (dev-master d1c0b02): Downloading (100%)         
  - Removing symfony/stopwatch (3.4.x-dev 162ab93)
  - Installing symfony/stopwatch (3.4.x-dev 0a9eecc): Downloading (100%)         
  - Removing symfony/routing (dev-master e87f6e9)
  - Installing symfony/routing (dev-master a53262e): Downloading (100%)         
  - Removing symfony/debug (dev-master 2b1c9fd)
  - Installing symfony/debug (dev-master 78a5af2): Downloading (100%)         
  - Removing symfony/cache (dev-master 8b89866)
  - Installing symfony/cache (dev-master 42c3604): Downloading (100%)         
  - Removing symfony/doctrine-bridge (3.4.x-dev 6e8fd7f)
  - Installing symfony/doctrine-bridge (3.4.x-dev 4cdde1e): Downloading (100%)         
  - Removing symfony/property-access (dev-master ffd0b28)
  - Installing symfony/property-access (dev-master 0da9ebd): Downloading (100%)         
  - Removing symfony/security (dev-master a732f3f)
  - Installing symfony/security (dev-master 768b768): Downloading (100%)         
  - Removing symfony/intl (dev-master b4eeb6b)
  - Installing symfony/intl (dev-master ca86058): Downloading (100%)         
  - Removing symfony/process (dev-master 8bdb547)
  - Installing symfony/process (dev-master 3bce28b): Downloading (100%)         
  - Removing symfony/translation (dev-master 4d6d3dd)
  - Installing symfony/translation (dev-master a87e0cc): Downloading (100%)         
  - Removing phpunit/phpunit (dev-master 077a638)
  - Installing phpunit/phpunit (dev-master db5b7d5): Downloading (100%)         
  - Removing symfony/var-dumper (dev-master 060ff4d)
  - Installing symfony/var-dumper (dev-master 5633848): Downloading (100%)         
  - Removing symfony/console (3.4.x-dev 0353f8a)
  - Installing symfony/console (3.4.x-dev 1053791): Downloading (100%)         
  - Removing symfony/web-server-bundle (3.4.x-dev a4cdf82)
  - Installing symfony/web-server-bundle (3.4.x-dev ab38f26): Downloading (100%)         
  - Removing symfony/dotenv (3.4.x-dev cbd0766)
  - Installing symfony/dotenv (3.4.x-dev aaf1904): Downloading (100%)         
  - Removing symfony/twig-bundle (3.4.x-dev af0894b)
  - Installing symfony/twig-bundle (3.4.x-dev ae41aa0): Downloading (100%)         
  - Removing symfony/web-profiler-bundle (3.4.x-dev 64adcca)
  - Installing symfony/web-profiler-bundle (3.4.x-dev 47e8d1e): Downloading (100%)         
  - Removing symfony/validator (3.4.x-dev c314bcc)
  - Installing symfony/validator (3.4.x-dev 6406c11): Downloading (100%)         
  - Removing symfony/framework-bundle (3.4.x-dev edc62cf)
  - Installing symfony/framework-bundle (3.4.x-dev 607ceec): Downloading (100%)         
  - Removing symfony/yaml (3.4.x-dev f46d917)
  - Installing symfony/yaml (3.4.x-dev 519fb08): Downloading (100%)         
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative %WEB_DIR% [OK]
Executing script vendor/bin/security-checker security:check --end-point=http://security.sensiolabs.org/check_lock [OK]
Executing script %BIN_DIR%/check.php [OK]

wunder@code-2017-VirtualBox:~/PhpstormProjects/symfony-flex-backend$ 

And after that if I run composer update

wunder@code-2017-VirtualBox:~/PhpstormProjects/symfony-flex-backend$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative %WEB_DIR% [KO]
 [KO]
Script assets:install --symlink --relative %WEB_DIR% returned with error code 1
!!  
!!  
!!                                                      
!!  
!!    [InvalidArgumentException]                        
!!    The target directory "%WEB_DIR%" does not exist.  
!!  
!!                                                      
!!  
!!  
!!  assets:install [--symlink] [--relative] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<target>]
!!  
!!  
!!  
wunder@code-2017-VirtualBox:~/PhpstormProjects/symfony-flex-backend$

Any ideas?

%WEB_DIR% has just been replaced with %PUBLIC_DIR% thanks to #122 and other PRs, have you checked this var in your composer.json file ?

@Pierstoval thanks, yeah that %WEB_DIR% has been changed to %PUBLIC_DIR% and web folder has been renamed to public. After I make those changes manually all started to working again.

After composer req form I've got two errors on the automated script execution make cache-clear that The Translation component is required to use the Form component. and after that The Validator component is required to use the Form component.

The Form component itself can work perfect without the validator and translator (which for Form is only required for validation). But when using the Form component with the FrameworkBundle there are additional requirements.

Eg. the FrameworkBundle needs to detect if these other components are installed (and otherwise disable there integration with the Form component). Or we need a form-pack to install the additional requirements for this Flex case.

Better experience on Symfony 3.4 now thanks to symfony/symfony#24303

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javiereguiluz picture javiereguiluz  路  4Comments

soullivaneuh picture soullivaneuh  路  6Comments

javiereguiluz picture javiereguiluz  路  6Comments

dmitriyoboldin picture dmitriyoboldin  路  6Comments

ro0NL picture ro0NL  路  4Comments