Answer the question
In order to leave comments, you need to log in
Why is Composer deleting my files?
There is a project on Silex that I got from one developer, I am finalizing it and I needed to fasten the language localization, I have the following vendor
folder structure, I
load the repository composer require symfony/translation
, as a result I get the following:
composer require symfony/translation
Using version ^3.2 for symfony/translation
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing emberlabs/gravatarlib (dev-master)
- Removing phpunit/phpunit (3.7.x-dev)
- Removing phpunit/php-code-coverage (1.2.x-dev)
- Removing phpunit/php-token-stream (dev-master)
- Removing phpunit/phpunit-mock-objects (1.2.x-dev)
- Removing doctrine/dbal (dev-master)
- Removing doctrine/common (2.4.x-dev)
- Removing doctrine/inflector (dev-master)
- Removing doctrine/cache (dev-master)
- Removing doctrine/collections (dev-master)
- Removing doctrine/annotations (dev-master)
- Removing doctrine/lexer (dev-master)
- Removing symfony/validator (dev-master)
- Removing symfony/serializer (dev-master)
- Removing symfony/process (dev-master)
- Removing symfony/monolog-bridge (dev-master)
- Removing monolog/monolog (dev-master)
- Removing symfony/finder (dev-master)
- Removing symfony/css-selector (dev-master)
- Removing symfony/browser-kit (dev-master)
- Removing symfony/dom-crawler (dev-master)
- Removing symfony/form (dev-master)
- Removing symfony/options-resolver (dev-master)
- Removing symfony/property-access (dev-master)
- Removing symfony/locale (dev-master)
- Removing symfony/intl (dev-master)
- Removing symfony/icu (1.0.x-dev)
- Removing symfony/security (dev-master)
- Removing symfony/filesystem (dev-master)
- Installing symfony/filesystem (v3.0.9)
Loading from cache
- Removing symfony/config (dev-master)
- Installing symfony/config (v2.8.14)
Loading from cache
- Removing symfony/yaml (dev-master)
- Installing symfony/yaml (v2.8.14)
Loading from cache
- Installing symfony/polyfill-mbstring (v1.3.0)
Loading from cache
- Removing symfony/translation (dev-master)
- Installing symfony/translation (v3.2.0)
Loading from cache
- Removing swiftmailer/swiftmailer (dev-master)
- Installing swiftmailer/swiftmailer (v5.4.4)
Loading from cache
- Removing symfony/stopwatch (dev-master)
- Installing symfony/stopwatch (v2.8.14)
Loading from cache
- Removing symfony/twig-bridge (dev-master)
- Installing symfony/twig-bridge (v2.8.14)
Loading from cache
- Removing symfony/routing (dev-master)
- Installing symfony/routing (v3.0.9)
Loading from cache
- Removing symfony/http-foundation (dev-master)
- Installing symfony/http-foundation (v3.0.9)
Loading from cache
- Removing symfony/event-dispatcher (dev-master)
- Installing symfony/event-dispatcher (v3.0.9)
Loading from cache
- Removing symfony/debug (dev-master)
- Installing symfony/debug (v3.2.0)
Loading from cache
- Removing symfony/http-kernel (dev-master)
- Installing symfony/http-kernel (v3.0.9)
Loading from cache
- Removing symfony/web-profiler-bundle (dev-master)
- Installing symfony/web-profiler-bundle (v2.8.14)
Loading from cache
- Updating pimple/pimple (1.1.x-dev bc2fc12 => v1.1.1)
Checking out 2019c145fe393923f3441b23f29bbdfaa5c58c4d
- Installing silex/silex (v1.3.5)
Loading from cache
Package kilte/silex-captcha is abandoned, you should avoid using it. Use amstaffix/silex-captcha instead.
Generating autoload files
Fatal error: Uncaught exception 'ReflectionException' with message 'Class Symfony\Component\Security\Http\Firewall\ContextListener does not exist' in \vendor\silex\silex\src\Silex\Provider\SecurityServiceProvider.php:78 Stack trace: #0 \vendor\silex\silex\src\Silex\Provider\SecurityServiceProvider.php(78): ReflectionMethod->__construct('Symfony\\Compone...', '__construct') #1 \vendor\silex\silex\src\Silex\Application.php(178): Silex\Provider\SecurityServiceProvider->register(Object(Silex\Application)) #2 \src\app.php(138): Silex\Application->register(Object(Silex\Provider\SecurityServiceProvider), Array) #3 \site.ru\index.php(12): require('C:\\OpenServer\\g...') #4 {main} thrown in \vendor\silex\silex\src\Silex\Provider\SecurityServiceProvider.php on line 78
Answer the question
In order to leave comments, you need to log in
Probably these packages were removed from the composer.json file, but are still present in the ./vendor/composer/installed.json file. The latter is used to store a list of installed packages.
By comparing these 2 files, the composer will determine which packages were removed from composer.json "manually" and remove them from the vendor folder.
Delete the entries in the installed.json file related to the packages you want to keep.
Source
Composer tries to install the latest version of symfony/translation, and in order to do so, it needs the correct versions of the symfony components. Try to specify a version for the symfony/translation component that will match the rest of the components (like dev-master).
And if you just do a composer update, does it update successfully?
And if I'm not mistaken, then using dev-master in production is strongly discouraged.
It is possible that these packages were not your application's dependencies, but its dependencies. If you need them, you must specify them explicitly in the root composer.json.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question