I changed my composer.json and suddenly, when I do
rm -rf vendor/* && rm -rf bin/* && composer update
I get error messages at the end of the process, because the Symfony console
isn't found in the folder bin
. When I manually copy it there from another project it works, but that cannot be the solution.
The error message is as follows:
....
- Installing symfony/test-pack (v1.0.6): Loading from cache
- Installing symfony/web-server-bundle (v4.3.6): 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 1
!! Could not open input file: ./bin/console
!!
Script @auto-scripts was called via post-update-cmd
The error is clear, since the bin folder does contain symlinks to loads of other scripts, but not the console script itself.
I tried clearing the composer cache, but it makes no difference.
If I create a complete new empty folder and copy the composer.json
file there and run composer install
, everything is fine and the console
script is in the bin
folder, where it should be.
What is the difference?
When I run it later automatically for automatic deployment, how can I be sure, that the console will be there?
First, you should not delete your bin/console
script. That's part of your application, it's equivalent to public/index.php
but as a console entry point.
Most likely, that file should be kept in your source code repository.
So the best way to guarantee that file will be there when you deploy would be: do not delete it, it's part of your source code and should be kept.
The file is created during install
on an empty folder because the flex recipe gets executed during install
because of two things:
bin
directory to create it anew, but it won't overwrite an existing directory. (Hence, if you keep this directory and its contents on your repo, as you should, it won't be overwritten when you deploy your project on production).