Closed nicwortel closed 8 years ago
What I might do is adding an autoloader (at the end of the autoloader stack) that catches attempts to load the PackageVersions\Versions.php
and tries to write it to disk (and if it fails, just uses an eval()
or a temporary file).
Out of my scope for now, though: I will consider it for when I got time to tinker around the lib again.
Reminder btw: don't deploy with composer install --no-scripts
. Instead, deploy a zip package with all deps (or an RPM).
@Ocramius thank you for the fast response! The autoloader approach actually sounds more elegant than my own.
Reminder btw: don't deploy with
composer install --no-scripts
. Instead, deploy a zip package with all deps (or an RPM).
I don't run Composer on the server, but on my local machine as part of a Phing build. However, since I use --no-dev
I need to add --no-scripts
as well, otherwise the scripts will cause fatal errors because they run in dev mode (and Phing does not seem to enable setting the SYMFONY_ENV=prod
environment variable).
If I'm just missing something or if there is a better way to do this, please let me know!
Uh... I would expect dev deps to only be used during a composer update
. Something is quite wrong with the setup there, but I don't have an idea if this is how symfony does stuff, usually..
Getting this even without --no-scripts
.
$ composer install
[ErrorException]
file_put_contents(/xyz/vendor/ocramius/package-versions/src/PackageVersions/Versions.php): failed to open stream: No such file or
directory
There's nothing funny w/ my composer.json; it was generated via composer init
.
composer --version
Composer version 1.1.2 2016-05-31 19:48:11
php -v
PHP 7.0.7 (cli) (built: May 27 2016 11:13:44) ( NTS )
Mac OS X
I get the same error using "composer install" (without parameters) and PHP 7.0.8:
"..." "Generating autoload files" "[ErrorException]" "file_put_contents(/path/to/vendor/ocramius/package-versions/src/PackageVersions/Versions.php): failed to open stream: No such file or directory"
My context: Symfony 2.7
Run it with -vvv please On 12 Jul 2016 5:59 p.m., "KatharinaSt" notifications@github.com wrote:
I get the same error using "composer install" (without parameters) and PHP 7.0.8:
"..." "Generating autoload files" "[ErrorException]" "file_put_contents(/path/to/vendor/ocramius/package-versions/src/PackageVersions/Versions.php): failed to open stream: No such file or directory"
My context: Symfony 2.7
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ocramius/PackageVersions/issues/18#issuecomment-232094290, or mute the thread https://github.com/notifications/unsubscribe/AAJakAdKIY08WtN2J3Kaw46KuHqdyuvwks5qU7n5gaJpZM4Idgqf .
Provided a fix via #33, please review.
The Versions class is not installed (and therefore calling it causes fatal errors) when dependencies are installed using
composer install --no-scripts
(which is, as far as I'm aware, not that uncommon in deployment scripts).I found out because I wanted to deploy a project to production, but the deployment failed on executing the Doctrine migrations:
I propose the following solution to catch cases where the
Versions
class has not been generated:Installer
create a seperate php file that returns an array;Versions
class, whichrequire
s the above file but calls theInstaller
when it does not exist.In the meanwhile, the only way for me to get Doctrine Migrations working again was by explicitly requiring
"ocramius/proxy-manager": "^1.0"
in my project'scomposer.lock
, in order to downgrade to a version of the proxy manager that does not require this package.