Closed YarGnawh closed 7 years ago
I am getting the same issue as well!
Ugh, can confirm this issue.
Looks like now you have to use johnpbloch/wordpress-core
package instead of johnpbloch/wordpress
@BoShurik I tried both, there is no diff. Removing the composer.lock file works
Removing the package and adding it back after clearing the cache seems to work.
See https://twitter.com/johnpbloch/status/843118839843962881 and https://twitter.com/schaetzle/status/843740809165987841
@ocean90 thanks! removing and adding it works. though it's far from ideal :neutral_face:
This broke an install for me last night when I deployed an update. Does anyone know if we have to run these composer commands on the server as well or just locally and the .lock file fixes this on the next deploy?
I can also confirm that I was having the exact same issue and that simply removing the composer.lock file fixes this particular issue while leaving "johnpbloch/wordpress": "4.7.3" in my composer.json
Hey everyone,
I was running into this issue as well. When I dug into what was going on, it turns out whoever initially set up the project added the wordpress dependency to the composer.json like so:
"johnpbloch/wordpress": "*",
This is telling composer "pull any newly released code". There must have been a major version release (i.e. a v5
, a release that included breaking changes) and the breaking changes, you know, broke our project.
Here are the steps I went through to fix the issue:
This should pull down your dependencies again and install the older version of the wordpress package.
If you want to learn more about semantic versioning and why it broke my install (and maybe yours) check out http://semver.org.
Here's a slightly improved version of the fix:
# Using jq to parse composer.lock (https://stedolan.github.io/jq/)
# Try to get the committed version or fallback to *
wp_version=$(jq` -r '.packages | map(select(.name == "johnpbloch/wordpress")) | .[0]?.version // "*"' composer.lock)
composer remove johnpbloch/wordpress
composer clear-cache
composer require johnpbloch/wordpress:${wp_version}
composer update
This is a decent solution @YarGnawh, though considering this issue for people may be stemming from a lack of understanding of the composer file, semantic, and dependency management I'd encourage people (if they're running into this issue because of a *
version pattern) to walk through the discovery and fix manually to start building up that knowledge.
It's great to have a copy/paste solution, but copy/paste without understanding what landed some people (including some members of my team) in this situation in the first place. That's why I tried to be super detailed in the why and how of the problem and fix.
Not trying to knock you down, just trying to caution people to address the real underlying problem.
@johnpbloch Really bad move to make this change without notice and break tens of thousands of Composer setups.
You should have created a new package instead and left this as legacy, or at least left the old branches intact so that dist links would keep on working.
Confirmed while using
"require": {
"johnpbloch/wordpress": "4.7.*"
}
Will attempt the cache and lock file juggling.
Without any changes to composer.json I have everything running again this morning by removing vendor and the lock file, clearing composer cache and then running composer install again.
I think I'm experiencing a similar issue. In my case, I have the following in my composer.json
:
"johnpbloch/wordpress": "4.7.3",
This was working fine for a while, but I noticed after I added a new dependency and ran composer update
that the hashes in the lock file changed for johnpbloch/wordpress:
"source": {
"type": "git",
"url": "https://github.com/johnpbloch/wordpress.git",
- "reference": "eef7c0520b1e7187cd2cd7540dc997c4c3b0340a"
+ "reference": "9f1f8eb6c37d10d73b9d7946c0ab5425a5492a9a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/eef7c0520b1e7187cd2cd7540dc997c4c3b0340a",
- "reference": "eef7c0520b1e7187cd2cd7540dc997c4c3b0340a",
+ "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/9f1f8eb6c37d10d73b9d7946c0ab5425a5492a9a",
+ "reference": "9f1f8eb6c37d10d73b9d7946c0ab5425a5492a9a",
"shasum": ""
},
The GOOD reference is: eef7c0520b1e7187cd2cd7540dc997c4c3b0340a
. Reverting those back manually seemed to fix it for me...
This just happened to me again today.
This randomly keeps happening even with all caches cleared, locks destroyed, and vendor dirs cleaned.
I resorted to just adding the johnpblock/wordpress-core-installer
and johnpbloch/wordpress-core
directly to our composer.json
. This may not be a wise choice in the long run but at least it seems to work better for now.
To get past this error
[InvalidArgumentException]
Two packages cannot share the same directory!
Edit the vendor/composer/installed.json
file, and remove the entry for the johnpbloch/wordpress
package and save.
Run composer install
.
I'm trying to automate my deployments [...]
@YarGnawh How's that going for you? I'm curious because like yourself I'm planning on working on the same thing and would appreciate any learnings you could share.
@johnpbloch Really bad move to make this change without notice and break tens of thousands of Composer setups.
@khromov you have the ability to fork and create your own composer module, or try another tool. Please do not shit on maintainers of FOSS tools. Because without them you wouldn't have had the pleasure of experiencing this issue.
@jhabdas Letting the maintainer know there were better options available is hardly to "shit" on them. If I woke up one day and decided to break a package for all its users, I'd expect some of them to voice their concerns.
@khromov I'm specifically referring to the following comment, where you shit on them:
Please don't do that. No cool. The FOSS community is a cornucopia of available options. And that being the case it's up to the individual consuming the software to read clause in the license which states NO WARRANTY and move on their their day. There's not much more to it.
@jhabdas The latter half of that comment was about possible ways to have avoided this scenario. I stand by that comment (very low-key criticism in my opinion) and I don't think I worded it in a harsh way. I also think it's silly @johnpbloch hasn't responded to this thread, although I don't blame him for it.
@jhabdas please stop harassing @khromov. I never took his comment to be anything other than respectful and reasonable. And he was right.
@khromov it is a little silly. So let me start here:
I'm sorry. I made a pretty drastic change without thinking through all the implications. It broke a lot of sites and that's a pretty terrible result to have to own. You're absolutely right about both options for what would have been a better approach. Unfortunately, by the time you helped me see that, reverting the change would have re-broken all the sites that had just broken, so I just stayed the course. Again, I am sorry.
@jhabdas please stop harassing @khromov.
There's a clear difference between candor and harassment. @khromov and myself were having a conversation which didn't directly include you. But thank you for your misunderstanding.
@johnpbloch Thanks for the explanation. For what it's worth, I do think this change has improved the package structure a lot, so props to you! 🥇
There's a clear difference between candor and harassment.
Category error. I can harass somebody candidly.
@khromov and myself were having a conversation which didn't directly include you.
It's strange to say that a conversation about me in an issue on one of my repositories is something I'm not included in or that I shouldn't be entitled to respond to.
But thank you for your misunderstanding.
You are the one who jumped down somebody's throat because you misunderstood something they said.
Please stay on topic or stop commenting. If you have something to add that is germane to the issue this thread is about, feel free to continue discussing that.
I'm trying to automate my deployments, but I'm noticing when there's a composer.lock file in the project root, when I run composer install, the
wordpress-install-dir
only has thecomposer.json
andreadme.html
files. It doesn't actually install wordpress-core. Rather than ignoring the composer.lock file, is there a way to force composer to reinstall wordpress-core?So with a composer.lock file present, this is the result of running
composer install
and if I delete the composer.lock file, running
composer install
gives me thisThough deleting the
composer.lock
file fixes the issue, it seems like it's best practice to commit thecomposer.lock
file (http://stackoverflow.com/questions/12896780/should-composer-lock-be-committed-to-version-control)Additional example:
johnpbloch/wordpress-project
composer install
. It'll install wordpress core inpublic/wp
.composer.lock
file. Note: inside.gitignore
, there's a line forpublic/wp
,composer.lock
file)composer install
public/wp
, just thecomposer.json
andreadme.html