Closed windaishi closed 4 years ago
A possible solution (related: https://github.com/Ocramius/PackageVersions/issues/101) is to install with --no-scripts
, which defeats the purpose of this package, but solves your immediate woe.
When installing with --no-scripts
, if composer.lock
cannot be found, the package already falls back to trying to read installed.json
(or the other way around: can't remember clearly).
Two considerations have to be added to the pile here:
Composer\Package\Locker
now throws an exception seems to be an upstream BC break.Considering the above, I'm inclined to not fix this problem in the 1.x
series, and instead get it implicitly fixed with 2.0.0
.
Specifically, the only reason why I still need the lock file in the 1.x
series is to support the codegen for PackageVersions\Versions::ROOT_PACKAGE_NAME
, which is to be deprecated and removed as per https://github.com/Ocramius/PackageVersions/issues/139#issuecomment-657118021
Therefore, adding 2.0.0
milestone here, and this will be fixed with #139.
Hey, thanks for you fast reply!
When installing with --no-scripts, if composer.lock cannot be found, the package already falls back to trying to read installed.json (or the other way around: can't remember clearly).
Thanks for the hint! Currently we do not have to workaround the problem in this particular case, as it appeared only because of another problem. Anyway, I think this is a bug that should be fixed and therefore I reported it ;). This is also the reason why it is totally okay for us, that this is not fixed immediately.
In case someone has the same problem and stumbles across this thread: This is also a working work around:
lock: false
from composer.json
scripts
section:
"post-install-cmd": [
"@remove-lock-file"
],
"post-update-cmd": [
"@remove-lock-file"
],
"remove-lock-file": [
"# Workaround as long as composer does not support the corresponding config option to disable composer.lock",
"rm composer.lock"
],
(We used this workaround while composer did not support to disable the lock file.)
Shopware is a bit of a terrible monster: "a snake that eats its own tail", in German-ish slang, so I'm fairly sure it should be fixed there by using a standard installation approach, instead of hacking their way even further into a composer nightmare :-)
Yeah, "Shopware" appears in the stack trace but actually I think the problem is almost not Shopware related. The package that requires ocramius/package-versions
is ocramius/proxy-manager
.
Therefore, adding 2.0.0 milestone here, and this will be fixed with #139.
Nice 👍 I'm looking forward to it.
Composer has introduced the option to disable the lock file. This is helpful for libraries (for example). See: https://getcomposer.org/doc/06-config.md#lock
When the lock file is disabled but composer installs
ocramius/package-versions
because it is somewhere in the dependency graph, composer will fail with the following error message:Of course it fails, because the lock file is missing on purpose.
I assume that
ocramius/package-versions
is accessing the lock file to find out the installed package versions. Instead it should use the fileinstalled.json
. Maybe, for backwards-compatibility reasons, it should do that only if the lock file is disabled explicitly.Stack trace: